summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/mbstring/tests/bug43840.phpt72
-rw-r--r--ext/mbstring/tests/bug43841.phpt78
-rw-r--r--ext/mbstring/tests/bug43994.phpt121
-rw-r--r--ext/mbstring/tests/bug43998.phpt83
-rw-r--r--ext/mbstring/tests/common.inc7
-rw-r--r--ext/mbstring/tests/mb_convert_encoding_variation1.phpt207
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_basic.phpt35
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_error.phpt42
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_variation1.phpt210
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt51
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt29
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic.phpt20
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt73
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt70
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_indent.phpt901
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt3
-rw-r--r--ext/mbstring/tests/mb_ereg_basic.phpt20
-rw-r--r--ext/mbstring/tests/mb_ereg_error.phpt6
-rw-r--r--ext/mbstring/tests/mb_ereg_match_basic.phpt59
-rw-r--r--ext/mbstring/tests/mb_ereg_match_error1.phpt58
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_basic.phpt62
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_error.phpt52
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation1.phpt174
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation2.phpt182
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation3.phpt183
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation4.phpt183
-rw-r--r--ext/mbstring/tests/mb_ereg_variation3.phpt37
-rw-r--r--ext/mbstring/tests/mb_ereg_variation4.phpt47
-rw-r--r--ext/mbstring/tests/mb_ereg_variation5.phpt13
-rw-r--r--ext/mbstring/tests/mb_ereg_variation6.phpt32
-rw-r--r--ext/mbstring/tests/mb_ereg_variation7.phpt19
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt29
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_variation2.phpt213
-rw-r--r--ext/mbstring/tests/mb_split.phpt11
-rw-r--r--ext/mbstring/tests/mb_split_error.phpt50
-rw-r--r--ext/mbstring/tests/mb_split_variation1.phpt262
-rw-r--r--ext/mbstring/tests/mb_split_variation2.phpt248
-rw-r--r--ext/mbstring/tests/mb_split_variation3.phpt336
-rw-r--r--ext/mbstring/tests/mb_stripos_basic.phpt235
-rw-r--r--ext/mbstring/tests/mb_stripos_basic2.phpt129
-rw-r--r--ext/mbstring/tests/mb_stripos_error1.phpt11
-rw-r--r--ext/mbstring/tests/mb_stripos_error2.phpt12
-rw-r--r--ext/mbstring/tests/mb_stripos_variation1.phpt11
-rw-r--r--ext/mbstring/tests/mb_stripos_variation2.phpt14
-rw-r--r--ext/mbstring/tests/mb_stripos_variation3.phpt20
-rw-r--r--ext/mbstring/tests/mb_stripos_variation4.phpt66
-rw-r--r--ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt113
-rw-r--r--ext/mbstring/tests/mb_stristr_error1.phpt47
-rw-r--r--ext/mbstring/tests/mb_stristr_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_stristr_variation1.phpt208
-rw-r--r--ext/mbstring/tests/mb_stristr_variation2.phpt218
-rw-r--r--ext/mbstring/tests/mb_stristr_variation3.phpt232
-rw-r--r--ext/mbstring/tests/mb_stristr_variation4.phpt227
-rw-r--r--ext/mbstring/tests/mb_stristr_variation5.phpt69
-rw-r--r--ext/mbstring/tests/mb_strlen_basic.phpt4
-rw-r--r--ext/mbstring/tests/mb_strlen_variation1.phpt8
-rw-r--r--ext/mbstring/tests/mb_strpos_basic.phpt6
-rw-r--r--ext/mbstring/tests/mb_strpos_variation2.phpt10
-rw-r--r--ext/mbstring/tests/mb_strpos_variation3.phpt5
-rw-r--r--ext/mbstring/tests/mb_strpos_variation4.phpt6
-rw-r--r--ext/mbstring/tests/mb_strpos_variation5.phpt11
-rw-r--r--ext/mbstring/tests/mb_strrchr_basic.phpt64
-rw-r--r--ext/mbstring/tests/mb_strrchr_error1.phpt47
-rw-r--r--ext/mbstring/tests/mb_strrchr_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation1.phpt207
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation2.phpt207
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation3.phpt232
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation4.phpt227
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation5.phpt59
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation6.phpt65
-rw-r--r--ext/mbstring/tests/mb_strrichr_basic.phpt70
-rw-r--r--ext/mbstring/tests/mb_strrichr_error1.phpt47
-rw-r--r--ext/mbstring/tests/mb_strrichr_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation1.phpt207
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation2.phpt207
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation3.phpt232
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation4.phpt227
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation5.phpt69
-rw-r--r--ext/mbstring/tests/mb_strripos_basic.phpt158
-rw-r--r--ext/mbstring/tests/mb_strripos_basic2.phpt128
-rw-r--r--ext/mbstring/tests/mb_strripos_error1.phpt51
-rw-r--r--ext/mbstring/tests/mb_strripos_error2.phpt38
-rw-r--r--ext/mbstring/tests/mb_strripos_variation1.phpt183
-rw-r--r--ext/mbstring/tests/mb_strripos_variation2.phpt183
-rw-r--r--ext/mbstring/tests/mb_strripos_variation3_Bug45923.phpt196
-rw-r--r--ext/mbstring/tests/mb_strripos_variation4.phpt278
-rw-r--r--ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt99
-rw-r--r--ext/mbstring/tests/mb_strrpos_basic.phpt9
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation1.phpt9
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation3.phpt9
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation4.phpt6
-rw-r--r--ext/mbstring/tests/mb_strstr_basic.phpt64
-rw-r--r--ext/mbstring/tests/mb_strstr_error1.phpt47
-rw-r--r--ext/mbstring/tests/mb_strstr_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strstr_variation1.phpt209
-rw-r--r--ext/mbstring/tests/mb_strstr_variation2.phpt218
-rw-r--r--ext/mbstring/tests/mb_strstr_variation3.phpt232
-rw-r--r--ext/mbstring/tests/mb_strstr_variation4.phpt227
-rw-r--r--ext/mbstring/tests/mb_strstr_variation5.phpt59
-rw-r--r--ext/mbstring/tests/mb_strstr_variation6.phpt65
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation1.phpt5
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation4.phpt8
-rw-r--r--ext/mbstring/tests/mb_strtoupper_basic.phpt10
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation1.phpt4
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation4.phpt8
-rw-r--r--ext/mbstring/tests/mb_substitute_character_basic.phpt46
-rw-r--r--ext/mbstring/tests/mb_substitute_character_error.phpt35
-rw-r--r--ext/mbstring/tests/mb_substitute_character_variation1.phpt239
-rw-r--r--ext/mbstring/tests/mb_substitute_character_variation2.phpt42
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation1.phpt3
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation2.phpt5
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation3.phpt6
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation4.phpt8
-rw-r--r--ext/mbstring/tests/mb_substr_variation1.phpt4
-rw-r--r--ext/mbstring/tests/mb_substr_variation2.phpt21
-rw-r--r--ext/mbstring/tests/mb_substr_variation4.phpt25
-rw-r--r--ext/mbstring/tests/mb_substr_variation5.phpt21
-rw-r--r--ext/mbstring/tests/mb_substr_variation6.phpt137
-rw-r--r--ext/mbstring/tests/mb_substr_variation7.phpt138
121 files changed, 11088 insertions, 462 deletions
diff --git a/ext/mbstring/tests/bug43840.phpt b/ext/mbstring/tests/bug43840.phpt
new file mode 100644
index 0000000000..8119bae325
--- /dev/null
+++ b/ext/mbstring/tests/bug43840.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test mb_strpos() function : mb_strpos bounds check is byte count rather than a character count
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * mb_strpos bounds check is byte count rather than a character count:
+ * The multibyte string should be returning the same results as the ASCII string.
+ * Multibyte string was not returning error message until offset was passed the
+ * byte count of the string. Should return error message when passed character count.
+ */
+
+$offsets = array(20, 21, 22, 53, 54);
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+$needle = base64_decode('44CC');
+
+foreach($offsets as $i) {
+ echo "\n-- Offset is $i --\n";
+ echo "--Multibyte String:--\n";
+ var_dump( mb_strpos($string_mb, $needle, $i, 'UTF-8') );
+ echo"--ASCII String:--\n";
+ var_dump(mb_strpos(b'This is na English ta', b'a', $i));
+}
+?>
+--EXPECTF--
+-- Offset is 20 --
+--Multibyte String:--
+int(20)
+--ASCII String:--
+int(20)
+
+-- Offset is 21 --
+--Multibyte String:--
+bool(false)
+--ASCII String:--
+bool(false)
+
+-- Offset is 22 --
+--Multibyte String:--
+bool(false)
+--ASCII String:--
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Offset is 53 --
+--Multibyte String:--
+bool(false)
+--ASCII String:--
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Offset is 54 --
+--Multibyte String:--
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+--ASCII String:--
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt
new file mode 100644
index 0000000000..340916902e
--- /dev/null
+++ b/ext/mbstring/tests/bug43841.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test mb_strrpos() function : mb_strrpos offset is byte count for negative values
+--XFAIL--
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test that mb_strrpos offset is byte count for negative values (should be character count)
+ */
+
+$offsets = array(-25, -24, -13, -12);
+$string_mb =
+base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvv
+JfvvJjvvJnjgII=');
+$needle = base64_decode('44CC');
+
+foreach ($offsets as $i) {
+ echo "\n-- Offset is $i --\n";
+ echo "Multibyte String:\n";
+ var_dump( mb_strrpos($string_mb, $needle, $i, 'UTF-8') );
+ echo "ASCII String:\n";
+ echo "mb_strrpos:\n";
+ var_dump(mb_strrpos(b'This is na English ta', b'a', $i));
+ echo "strrpos:\n";
+ var_dump(strrpos(b'This is na English ta', b'a', $i));
+}
+?>
+
+--EXPECTF--
+-- Offset is -25 --
+Multibyte String:
+bool(false)
+ASCII String:
+mb_strrpos:
+bool(false)
+strrpos:
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+-- Offset is -24 --
+Multibyte String:
+int(9)
+ASCII String:
+mb_strrpos:
+bool(false)
+strrpos:
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+-- Offset is -13 --
+Multibyte String:
+int(9)
+ASCII String:
+mb_strrpos:
+bool(false)
+strrpos:
+bool(false)
+
+-- Offset is -12 --
+Multibyte String:
+int(9)
+ASCII String:
+mb_strrpos:
+int(9)
+strrpos:
+int(9)
+
diff --git a/ext/mbstring/tests/bug43994.phpt b/ext/mbstring/tests/bug43994.phpt
new file mode 100644
index 0000000000..9484a47849
--- /dev/null
+++ b/ext/mbstring/tests/bug43994.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test mb_ereg() function : mb_ereg 'successfully' matching incorrectly
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * mb_ereg 'successfully' matching incorrectly:
+ * Bug now seems to be fixed - error message is now generated when an 'empty'
+ * pattern is supplied to mb_ereg. Similar error message to ereg().
+ */
+
+$unset_var = 10;
+unset ($unset_var);
+$inputs = array(NULL, null, false, FALSE, "", '', @$undefined_var,
+@$unset_var);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ if(@is_array($mb_regs)){
+ $mb_regs = '';
+ }
+ echo "\n-- Iteration $iterator --\n";
+ echo "Without \$regs arg:\n";
+ var_dump( mb_ereg($input, 'hello, world') );
+ echo "With \$regs arg:\n";
+ var_dump(mb_ereg($input, 'hello, world', $mb_regs));
+ var_dump($mb_regs);
+ $iterator++;
+};
+?>
+
+--EXPECTF----
+-- Iteration 1 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 2 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 3 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 4 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 5 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 6 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 7 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+-- Iteration 8 --
+Without $regs arg:
+int(1)
+With $regs arg:
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
diff --git a/ext/mbstring/tests/bug43998.phpt b/ext/mbstring/tests/bug43998.phpt
new file mode 100644
index 0000000000..87b354b49e
--- /dev/null
+++ b/ext/mbstring/tests/bug43998.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test mb_strtolower() function : Two error messages returned for incorrect encoding for mb_strto[upper|lower]
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strto[lower|upper](string $sourcestring [, string $encoding])
+ * Description: Returns a [lower|upper]cased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Two error messages returned for incorrect encoding for mb_strto[upper|lower]
+ * Bug now appears to be fixed
+ */
+
+$sourcestring = 'Hello, World';
+
+$inputs = array(12345, 12.3456789000E-10, true, false, "");
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strtolower($sourcestring, $input) );
+ var_dump( mb_strtoupper($sourcestring, $input) );
+ $iterator++;
+};
+?>
+--EXPECTF--
+-- Iteration 1 --
+
+Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtolower(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtoupper(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtolower(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtoupper(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtolower(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strtoupper(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
+string(12) "hello, world"
+
+Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
+string(12) "HELLO, WORLD"
+
+-- Iteration 5 --
+
+Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
+string(12) "hello, world"
+
+Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
+string(12) "HELLO, WORLD"
+
diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc
index b1a48ce72e..2c8a6a347c 100644
--- a/ext/mbstring/tests/common.inc
+++ b/ext/mbstring/tests/common.inc
@@ -19,7 +19,8 @@ function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
256 => "User Error", // E_USER_ERROR
512 => "User Warning", // E_USER_WARMING
1024=> "User Notice", // E_USER_NOTICE
- 4096=> "Catchable fatal error" // E_RECOVERABLE_ERROR
+ 2048=> "Strict Notice", // E_STRICT
+ 4096=> "Catchable fatal error", // E_RECOVERABLE_ERROR
);
if (!empty($debug)) {
@@ -35,13 +36,13 @@ set_error_handler('test_error_handler');
// Var def for testing
$t_ary = array(
- 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó',
+ 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó',
's2' => 'English Text'
);
class tc
{
- public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
+ public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
public $s2 = 'English Text';
function tc()
diff --git a/ext/mbstring/tests/mb_convert_encoding_variation1.phpt b/ext/mbstring/tests/mb_convert_encoding_variation1.phpt
new file mode 100644
index 0000000000..d3fff51507
--- /dev/null
+++ b/ext/mbstring/tests/mb_convert_encoding_variation1.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test mb_convert_encoding() function : usage variations - pass different data types as $to_encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_convert_encoding') or die("skip mb_convert_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_convert_encoding(string $str, string $to_encoding [, mixed $from_encoding])
+ * Description: Returns converted string in desired encoding
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+
+/*
+ * Pass different data types to $to_encoding arg to test behaviour of mb_convert_encoding
+ */
+
+echo "*** Testing mb_convert_encoding() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+mb_internal_encoding('utf-8');
+$sourcestring = b'hello, world';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $to_encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mb_convert_encoding()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(bin2hex( mb_convert_encoding($sourcestring, $input, 'ISO-8859-1') ));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_convert_encoding() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_convert_encoding(): Unknown encoding "0" in %s on line %d
+unicode(0) ""
+
+-- Iteration 2 --
+
+Warning: mb_convert_encoding(): Unknown encoding "1" in %s on line %d
+unicode(0) ""
+
+-- Iteration 3 --
+
+Warning: mb_convert_encoding(): Unknown encoding "12345" in %s on line %d
+unicode(0) ""
+
+-- Iteration 4 --
+
+Warning: mb_convert_encoding(): Unknown encoding "-2345" in %s on line %d
+unicode(0) ""
+
+-- Iteration 5 --
+
+Warning: mb_convert_encoding(): Unknown encoding "10.5" in %s on line %d
+unicode(0) ""
+
+-- Iteration 6 --
+
+Warning: mb_convert_encoding(): Unknown encoding "-10.5" in %s on line %d
+unicode(0) ""
+
+-- Iteration 7 --
+
+Warning: mb_convert_encoding(): Unknown encoding "123456789000" in %s on line %d
+unicode(0) ""
+
+-- Iteration 8 --
+
+Warning: mb_convert_encoding(): Unknown encoding "1.23456789E-9" in %s on line %d
+unicode(0) ""
+
+-- Iteration 9 --
+
+Warning: mb_convert_encoding(): Unknown encoding "0.5" in %s on line %d
+unicode(0) ""
+
+-- Iteration 10 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 11 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 12 --
+
+Warning: mb_convert_encoding(): Unknown encoding "1" in %s on line %d
+unicode(0) ""
+
+-- Iteration 13 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 14 --
+
+Warning: mb_convert_encoding(): Unknown encoding "1" in %s on line %d
+unicode(0) ""
+
+-- Iteration 15 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 16 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 17 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 18 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 19 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 20 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 21 --
+
+Warning: mb_convert_encoding(): Unknown encoding "Class A object" in %s on line %d
+unicode(0) ""
+
+-- Iteration 22 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 23 --
+unicode(24) "68656c6c6f2c20776f726c64"
+
+-- Iteration 24 --
+
+Warning: mb_convert_encoding() expects parameter 2 to be binary string, resource given in %s on line %d
+unicode(0) ""
+Done
+
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt
new file mode 100644
index 0000000000..ec9ff6b409
--- /dev/null
+++ b/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_decode_mimeheader() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_decode_mimeheader') or die("skip mb_decode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_decode_mimeheader(string string)
+ * Description: Decodes the MIME "encoded-word" in the string
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_decode_mimeheader() : basic functionality ***\n";
+mb_internal_encoding('utf-8');
+
+//the following encoded-words are identical and are UTF-8 Japanese.
+$a = "=?UTF-8?b?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?=";
+$b = mb_decode_mimeheader($a);
+var_dump(bin2hex($b));
+
+$a = "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
+=?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82?=";
+$b = mb_decode_mimeheader($a);
+var_dump(bin2hex($b));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_decode_mimeheader() : basic functionality ***
+unicode(60) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e38082"
+unicode(60) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e38082"
+===DONE===
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_error.phpt b/ext/mbstring/tests/mb_decode_mimeheader_error.phpt
new file mode 100644
index 0000000000..c40cdbd643
--- /dev/null
+++ b/ext/mbstring/tests/mb_decode_mimeheader_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test mb_decode_mimeheader() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_decode_mimeheader') or die("skip mb_decode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_decode_mimeheader(string string)
+ * Description: Decodes the MIME "encoded-word" in the string
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_decode_mimeheader() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing mb_decode_mimeheader() function with Zero arguments --\n";
+var_dump( mb_decode_mimeheader() );
+
+//Test mb_decode_mimeheader with one more than the expected number of arguments
+echo "\n-- Testing mb_decode_mimeheader() function with more than expected no. of arguments --\n";
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( mb_decode_mimeheader($string, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_decode_mimeheader() : error conditions ***
+
+-- Testing mb_decode_mimeheader() function with Zero arguments --
+
+Warning: mb_decode_mimeheader() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing mb_decode_mimeheader() function with more than expected no. of arguments --
+
+Warning: mb_decode_mimeheader() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_variation1.phpt b/ext/mbstring/tests/mb_decode_mimeheader_variation1.phpt
new file mode 100644
index 0000000000..ab0db249ea
--- /dev/null
+++ b/ext/mbstring/tests/mb_decode_mimeheader_variation1.phpt
@@ -0,0 +1,210 @@
+--TEST--
+p8_only
+Title: Test mb_decode_mimeheader() function : usage variation
+Internal Reason: we output an extra warning message
+P8 only feature: Yes
+Author: D. Kelsey
+Date: 01/09/2008
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_decode_mimeheader') or die("skip mb_decode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_decode_mimeheader(string string)
+ * Description: Decodes the MIME "encoded-word" in the string
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_decode_mimeheader() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for string
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_decode_mimeheader($value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_decode_mimeheader() : usage variation ***
+
+--int 0--
+string(1) "0"
+
+--int 1--
+string(1) "1"
+
+--int 12345--
+string(5) "12345"
+
+--int -12345--
+string(5) "-2345"
+
+--float 10.5--
+string(4) "10.5"
+
+--float -10.5--
+string(5) "-10.5"
+
+--float 12.3456789000e10--
+string(12) "123456789000"
+
+--float -12.3456789000e10--
+string(13) "-123456789000"
+
+--float .5--
+string(3) "0.5"
+
+--empty array--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+string(0) ""
+
+--lowercase null--
+string(0) ""
+
+--lowercase true--
+string(1) "1"
+
+--lowercase false--
+string(0) ""
+
+--uppercase TRUE--
+string(1) "1"
+
+--uppercase FALSE--
+string(0) ""
+
+--empty string DQ--
+string(0) ""
+
+--empty string SQ--
+string(0) ""
+
+--instance of classWithToString--
+string(14) "Class A object"
+
+--instance of classWithoutToString--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, object given, %s(%d)
+NULL
+
+--undefined var--
+string(0) ""
+
+--unset var--
+string(0) ""
+
+--resource--
+Error: 2 - mb_decode_mimeheader() expects parameter 1 to be binary string, resource given, %s(%d)
+NULL
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt b/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt
new file mode 100644
index 0000000000..cc3db3631c
--- /dev/null
+++ b/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test mb_decode_mimeheader() function : variation
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_decode_mimeheader') or die("skip mb_decode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_decode_mimeheader(string string)
+ * Description: Decodes the MIME "encoded-word" in the string
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_decode_mimeheader() : variation ***\n";
+mb_internal_encoding('utf-8');
+
+//all the following are identical, we will convert to utf-8
+
+$encoded_words = array(
+"=?Shift_JIS?B?k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==?=",
+"=?Shift_JIS?Q?=93=FA=96=7B=8C=EA=83e=83L=83X=83g=82=C5=82=B7=81B=30=31=32?=
+=?Shift_JIS?Q?=33=34=82T=82U=82V=82W=82X=81B?=",
+
+"=?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYbKEI=?=
+=?ISO-2022-JP?B?GyRCIzcjOCM5ISMbKEI=?=",
+"=?ISO-2022-JP?Q?=1B=24BF=7CK=5C=38l=25F=25-=25=39=25H=24G=24=39=1B=28B?=
+=?ISO-2022-JP?Q?=1B=24B!=23=1B=28B=30=31=32=33=34=1B=24B=23=35=1B=28B?=
+=?ISO-2022-JP?Q?=1B=24B=23=36=23=37=23=38=23=39!=23=1B=28B?=",
+
+"=?EUC-JP?B?xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==?=",
+"=?EUC-JP?Q?=C6=FC=CB=DC=B8=EC=A5=C6=A5=AD=A5=B9=A5=C8=A4=C7=A4=B9=A1=A3?=
+=?EUC-JP?Q?=30=31=32=33=34=A3=B5=A3=B6=A3=B7=A3=B8=A3=B9=A1=A3?="
+ );
+
+ foreach ($encoded_words as $word) {
+ var_dump(bin2hex(mb_decode_mimeheader($word)));
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_decode_mimeheader() : variation ***
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+===DONE===
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt b/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt
new file mode 100644
index 0000000000..390b2af4b4
--- /dev/null
+++ b/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test mb_decode_mimeheader() function : variation
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_decode_mimeheader') or die("skip mb_decode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_decode_mimeheader(string string)
+ * Description: Decodes the MIME "encoded-word" in the string
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_decode_mimeheader() : variation ***\n";
+mb_internal_encoding('iso-8859-7');
+
+//greek in UTF-8 to be converted to iso-8859-7
+$encoded_word = "=?UTF-8?B?zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J?=";
+var_dump(bin2hex(mb_decode_mimeheader($encoded_word)));
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_decode_mimeheader() : variation ***
+unicode(48) "e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f3f4f5f6f7f8f9"
+===DONE===
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
index 5871cbff87..413ab06304 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
@@ -21,13 +21,22 @@ function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is n
*/
echo "*** Testing mb_encode_mimeheader() : basic ***\n";
-mb_internal_encoding('utf-8');
-$inputs = array('English' => 'This is an English string. 0123456789',
- 'Japanese' => base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC'),
+$english = array('English' => 'This is an English string. 0123456789');
+$nonEnglish = array('Japanese' => base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC'),
'Greek' => base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg=='));
-foreach ($inputs as $lang => $input) {
+foreach ($english as $lang => $input) {
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
+}
+
+mb_internal_encoding('utf-8');
+
+foreach ($nonEnglish as $lang => $input) {
echo "\nLanguage: $lang\n";
echo "-- Base 64: --\n";
var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
@@ -37,7 +46,7 @@ foreach ($inputs as $lang => $input) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_encode_mimeheader() : basic ***
Language: English
@@ -63,3 +72,4 @@ string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9
=?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
=?UTF-8?Q?=39=2E?="
Done
+
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt
new file mode 100644
index 0000000000..cd52fa526d
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test mb_encode_mimeheader() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader(string $str [, string $charset
+ * [, string $transfer-encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_encode_header() with different strings
+ */
+
+echo "*** Testing mb_encode_mimeheader() : basic2 ***\n";
+
+//All strings are the same when displayed in their respective encodings
+$sjis_string = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
+$jis_string = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
+$euc_jp_string = base64_decode('xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==');
+
+$inputs = array('SJIS' => $sjis_string,
+ 'JIS' => $jis_string,
+ 'EUC_JP' => $euc_jp_string);
+
+foreach ($inputs as $lang => $input) {
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ mb_internal_encoding($lang);
+ $outEncoding = "UTF-8";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : basic2 ***
+
+Language: SJIS
+-- Base 64: --
+string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
+ =?UTF-8?B?77yY77yZ44CC?="
+-- Quoted-Printable --
+string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
+ =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
+ =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
+
+Language: JIS
+-- Base 64: --
+string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
+ =?UTF-8?B?77yY77yZ44CC?="
+-- Quoted-Printable --
+string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
+ =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
+ =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
+
+Language: EUC_JP
+-- Base 64: --
+string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
+ =?UTF-8?B?77yY77yZ44CC?="
+-- Quoted-Printable --
+string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
+ =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
+ =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
+Done
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt
new file mode 100644
index 0000000000..ecd98d6e80
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test mb_encode_mimeheader() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader(string $str [, string $charset
+ * [, string $transfer-encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_encode_header() with different strings
+ */
+
+echo "*** Testing mb_encode_mimeheader() : basic2 ***\n";
+
+//All strings are the same when displayed in their respective encodings
+$sjis_string = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
+$jis_string = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
+$euc_jp_string = base64_decode('xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==');
+
+$inputs = array('SJIS' => $sjis_string,
+ 'JIS' => $jis_string,
+ 'EUC_JP' => $euc_jp_string);
+
+foreach ($inputs as $lang => $input) {
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ mb_internal_encoding($lang);
+ $outEncoding = $lang;
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : basic2 ***
+
+Language: SJIS
+-- Base 64: --
+string(68) "=?Shift_JIS?B?k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==?="
+-- Quoted-Printable --
+string(124) "=?Shift_JIS?Q?=93=FA=96=7B=8C=EA=83e=83L=83X=83g=82=C5=82=B7=81B=30=31=32?=
+ =?Shift_JIS?Q?=33=34=82T=82U=82V=82W=82X=81B?="
+
+Language: JIS
+-- Base 64: --
+string(115) "=?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYbKEI=?=
+ =?ISO-2022-JP?B?GyRCIzcjOCM5ISMbKEI=?="
+-- Quoted-Printable --
+string(209) "=?ISO-2022-JP?Q?=1B=24BF=7CK=5C=38l=25F=25-=25=39=25H=24G=24=39=1B=28B?=
+ =?ISO-2022-JP?Q?=1B=24B!=23=1B=28B=30=31=32=33=34=1B=24B=23=35=1B=28B?=
+ =?ISO-2022-JP?Q?=1B=24B=23=36=23=37=23=38=23=39!=23=1B=28B?="
+
+Language: EUC_JP
+-- Base 64: --
+string(65) "=?EUC-JP?B?xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==?="
+-- Quoted-Printable --
+string(140) "=?EUC-JP?Q?=C6=FC=CB=DC=B8=EC=A5=C6=A5=AD=A5=B9=A5=C8=A4=C7=A4=B9=A1=A3?=
+ =?EUC-JP?Q?=30=31=32=33=34=A3=B5=A3=B6=A3=B7=A3=B8=A3=B9=A1=A3?="
+Done
+
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_indent.phpt b/ext/mbstring/tests/mb_encode_mimeheader_indent.phpt
new file mode 100644
index 0000000000..11fe23f531
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_indent.phpt
@@ -0,0 +1,901 @@
+--TEST--
+Test mb_encode_mimeheader() function : basic functionality, indent
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $indent argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : indent ***\n";
+
+mb_internal_encoding('utf-8');
+
+// Initialise function arguments not being substituted
+$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
+$charset = 'utf-8';
+$linefeed = "\r\n";
+
+for ($i = 0; $i < 100; $i++) {
+ echo "\n-- Iteration $i --\n";
+ var_dump( mb_encode_mimeheader($str, $charset, "B", $linefeed, $i));
+ var_dump( mb_encode_mimeheader($str, $charset, "Q", $linefeed, $i));
+};
+echo "Done";
+?>
+--EXPECT--
+*** Testing mb_encode_mimeheader() : indent ***
+
+-- Iteration 0 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 1 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 2 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 3 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 4 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrU=?=
+ =?UTF-8?B?zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9?=
+ =?UTF-8?Q?=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36?=
+ =?UTF-8?Q?=37=38=39=2E?="
+
+-- Iteration 5 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrU=?=
+ =?UTF-8?B?zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9?=
+ =?UTF-8?Q?=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36?=
+ =?UTF-8?Q?=37=38=39=2E?="
+
+-- Iteration 6 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrU=?=
+ =?UTF-8?B?zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9?=
+ =?UTF-8?Q?=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36?=
+ =?UTF-8?Q?=37=38=39=2E?="
+
+-- Iteration 7 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrU=?=
+ =?UTF-8?B?zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 8 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66?=
+ =?UTF-8?B?zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 9 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66?=
+ =?UTF-8?B?zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 10 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66?=
+ =?UTF-8?B?zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 11 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66?=
+ =?UTF-8?B?zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 12 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+M?=
+ =?UTF-8?B?IM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1?=
+ =?UTF-8?Q?=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20?=
+ =?UTF-8?Q?=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34?=
+ =?UTF-8?Q?=35=36=37=38=39=2E?="
+
+-- Iteration 13 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+M?=
+ =?UTF-8?B?IM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 14 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+M?=
+ =?UTF-8?B?IM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 15 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+M?=
+ =?UTF-8?B?IM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 16 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrk=?=
+ =?UTF-8?B?zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 17 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrk=?=
+ =?UTF-8?B?zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 18 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrk=?=
+ =?UTF-8?B?zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD?=
+ =?UTF-8?Q?=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C?=
+ =?UTF-8?Q?=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33?=
+ =?UTF-8?Q?=34=35=36=37=38=39=2E?="
+
+-- Iteration 19 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrk=?=
+ =?UTF-8?B?zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 20 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869?=
+ =?UTF-8?B?zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 21 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869?=
+ =?UTF-8?B?zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 22 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869?=
+ =?UTF-8?B?zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 23 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869?=
+ =?UTF-8?B?zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 24 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrs=?=
+ =?UTF-8?B?zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF?=
+ =?UTF-8?Q?=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA?=
+ =?UTF-8?Q?=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31?=
+ =?UTF-8?Q?=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 25 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrs=?=
+ =?UTF-8?B?zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 26 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrs=?=
+ =?UTF-8?B?zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 27 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrs=?=
+ =?UTF-8?B?zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 28 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67?=
+ =?UTF-8?B?zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 29 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67?=
+ =?UTF-8?B?zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 30 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67?=
+ =?UTF-8?B?zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9?=
+ =?UTF-8?Q?=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20?=
+ =?UTF-8?Q?=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 31 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67?=
+ =?UTF-8?B?zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 32 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSA=?=
+ =?UTF-8?B?zrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 33 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSA=?=
+ =?UTF-8?B?zrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 34 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSA=?=
+ =?UTF-8?B?zrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 35 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSA=?=
+ =?UTF-8?B?zrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 36 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrE=?=
+ =?UTF-8?B?zrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4?=
+ =?UTF-8?B?OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20?=
+ =?UTF-8?Q?=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD?=
+ =?UTF-8?Q?=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF?=
+ =?UTF-8?Q?=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 37 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrE=?=
+ =?UTF-8?B?zrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4?=
+ =?UTF-8?B?OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C?=
+ =?UTF-8?Q?=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7?=
+ =?UTF-8?Q?=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD?=
+ =?UTF-8?Q?=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 38 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrE=?=
+ =?UTF-8?B?zrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4?=
+ =?UTF-8?B?OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C?=
+ =?UTF-8?Q?=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7?=
+ =?UTF-8?Q?=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD?=
+ =?UTF-8?Q?=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 39 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrE=?=
+ =?UTF-8?B?zrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEyMzQ1Njc4?=
+ =?UTF-8?B?OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C?=
+ =?UTF-8?Q?=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB=CE=B7?=
+ =?UTF-8?Q?=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5=CE=BD?=
+ =?UTF-8?Q?=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 40 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869?=
+ =?UTF-8?B?zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2?=
+ =?UTF-8?B?Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 41 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869?=
+ =?UTF-8?B?zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2?=
+ =?UTF-8?B?Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 42 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869?=
+ =?UTF-8?B?zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2?=
+ =?UTF-8?B?Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 43 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869?=
+ =?UTF-8?B?zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2?=
+ =?UTF-8?B?Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 44 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrU=?=
+ =?UTF-8?B?zq/Ovc6xzrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEy?=
+ =?UTF-8?B?MzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 45 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrU=?=
+ =?UTF-8?B?zq/Ovc6xzrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEy?=
+ =?UTF-8?B?MzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84?=
+ =?UTF-8?Q?=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB=CE=BB?=
+ =?UTF-8?Q?=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC=CE=B5?=
+ =?UTF-8?Q?=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 46 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrU=?=
+ =?UTF-8?B?zq/Ovc6xzrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEy?=
+ =?UTF-8?B?MzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85?=
+ =?UTF-8?Q?=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB?=
+ =?UTF-8?Q?=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC?=
+ =?UTF-8?Q?=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 47 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wgzrU=?=
+ =?UTF-8?B?zq/Ovc6xzrkgzrXOu867zrfOvc65zrrPjCDOus61zq/OvM61zr3Ovy4gMDEy?=
+ =?UTF-8?B?MzQ1Njc4OS4=?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85?=
+ =?UTF-8?Q?=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB?=
+ =?UTF-8?Q?=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC?=
+ =?UTF-8?Q?=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 48 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wg?=
+ =?UTF-8?B?zrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAw?=
+ =?UTF-8?B?MTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85?=
+ =?UTF-8?Q?=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB?=
+ =?UTF-8?Q?=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC?=
+ =?UTF-8?Q?=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 49 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wg?=
+ =?UTF-8?B?zrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAw?=
+ =?UTF-8?B?MTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85?=
+ =?UTF-8?Q?=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB?=
+ =?UTF-8?Q?=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC?=
+ =?UTF-8?Q?=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 50 --
+string(130) "=?UTF-8?B?zpHPhc+Ez4wg?=
+ =?UTF-8?B?zrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAw?=
+ =?UTF-8?B?MTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85?=
+ =?UTF-8?Q?=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20=CE=B5=CE=BB?=
+ =?UTF-8?Q?=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5=CE=AF=CE=BC?=
+ =?UTF-8?Q?=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38=39=2E?="
+
+-- Iteration 51 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 52 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 53 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 54 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 55 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 56 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 57 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 58 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 59 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 60 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 61 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 62 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 63 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 64 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 65 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 66 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 67 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 68 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 69 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 70 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 71 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 72 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 73 --
+string(118) "
+ =?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(252) "
+ =?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 74 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 75 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 76 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 77 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 78 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 79 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 80 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 81 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 82 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 83 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 84 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 85 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 86 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 87 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 88 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 89 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 90 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 91 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 92 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 93 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 94 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 95 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 96 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 97 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 98 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+
+-- Iteration 99 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+Done
+
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt
index b7a4ba6f18..99a3165964 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt
@@ -19,8 +19,6 @@ function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is n
echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
-mb_internal_encoding('utf-8');
-
// Initialise function arguments not being substituted
$charset = 'utf-8';
$transfer_encoding = 'B';
@@ -184,3 +182,4 @@ string(0) ""
Warning: mb_encode_mimeheader() expects parameter 1 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_ereg_basic.phpt b/ext/mbstring/tests/mb_ereg_basic.phpt
index c9af72f6a8..db28223393 100644
--- a/ext/mbstring/tests/mb_ereg_basic.phpt
+++ b/ext/mbstring/tests/mb_ereg_basic.phpt
@@ -23,9 +23,9 @@ if(mb_regex_encoding('utf-8') == true) {
} else {
echo "Could not set regex encoding to utf-8\n";
}
-$string_ascii = 'This is an English string. 0123456789.';
-$regex_ascii1 = '(.*is)+.*\.[[:blank:]][0-9]{9}';
-$regex_ascii2 = '.*is+';
+$string_ascii = b'This is an English string. 0123456789.';
+$regex_ascii1 = b'(.*is)+.*\.[[:blank:]][0-9]{9}';
+$regex_ascii2 = b'.*is+';
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
$regex_mb1 = base64_decode('KOaXpeacrOiqnikuKj8oWzEtOV0rKQ==');
@@ -37,9 +37,9 @@ var_dump(mb_ereg($regex_ascii1, $string_ascii));
var_dump(mb_ereg($regex_ascii2, $string_ascii));
echo "--With \$regs argument --\n";
var_dump(mb_ereg($regex_ascii1, $string_ascii, $regs_ascii1));
-var_dump($regs_ascii1);
+base64_encode_var_dump($regs_ascii1);
var_dump(mb_ereg($regex_ascii2, $string_ascii, $regs_ascii2));
-var_dump($regs_ascii2);
+base64_encode_var_dump($regs_ascii2);
echo "\n**-- Multibyte String --**\n";
echo "-- Without \$regs argument --\n";
@@ -88,14 +88,14 @@ int(1)
int(36)
array(2) {
[0]=>
- string(36) "This is an English string. 012345678"
+ string(48) "VGhpcyBpcyBhbiBFbmdsaXNoIHN0cmluZy4gMDEyMzQ1Njc4"
[1]=>
- string(17) "This is an Englis"
+ string(24) "VGhpcyBpcyBhbiBFbmdsaXM="
}
int(17)
array(1) {
[0]=>
- string(17) "This is an Englis"
+ string(24) "VGhpcyBpcyBhbiBFbmdsaXM="
}
**-- Multibyte String --**
@@ -103,7 +103,7 @@ array(1) {
int(1)
bool(false)
-- With $regs argument --
-int(15)
+int(35)
array(3) {
[0]=>
string(48) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzQ="
@@ -114,4 +114,4 @@ array(3) {
}
bool(false)
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_error.phpt b/ext/mbstring/tests/mb_ereg_error.phpt
index 21216257cd..3610aea4eb 100644
--- a/ext/mbstring/tests/mb_ereg_error.phpt
+++ b/ext/mbstring/tests/mb_ereg_error.phpt
@@ -21,15 +21,15 @@ echo "*** Testing mb_ereg() : error conditions ***\n";
//Test mb_ereg with one more than the expected number of arguments
echo "\n-- Testing mb_ereg() function with more than expected no. of arguments --\n";
-$pattern = 'string_val';
-$string = 'string_val';
+$pattern = b'string_val';
+$string = b'string_val';
$registers = array(1, 2);
$extra_arg = 10;
var_dump( mb_ereg($pattern, $string, $registers, $extra_arg) );
// Testing mb_ereg with one less than the expected number of arguments
echo "\n-- Testing mb_ereg() function with less than expected no. of arguments --\n";
-$pattern = 'string_val';
+$pattern = b'string_val';
var_dump( mb_ereg($pattern) );
echo "Done";
diff --git a/ext/mbstring/tests/mb_ereg_match_basic.phpt b/ext/mbstring/tests/mb_ereg_match_basic.phpt
new file mode 100644
index 0000000000..56710a93e2
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_match_basic.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test mb_ereg_match() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_match') or die("skip mb_ereg_match() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : bool mb_ereg_match(string $pattern, string $string [,string $option])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test basic functionality of mb_ereg_match
+ */
+
+mb_internal_encoding('UTF-8');
+mb_regex_encoding('UTF-8');
+
+echo "*** Testing mb_ereg_match() : basic functionality ***\n";
+$string_ascii = b'abc def, 0123456789';
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+//will return true as pattern matches from start of string
+echo "\n-- ASCII string 1 --\n";
+var_dump(mb_ereg_match(b'.*def', $string_ascii));
+
+//will return false as pattern would match half way through string
+echo "\n-- ASCII string 2 --\n";
+var_dump(mb_ereg_match(b'def', $string_ascii));
+
+echo "\n-- Multibyte string 1 --\n";
+$regex1 = base64_decode('5pel5pys6KqeKC4qKT9bMS05XSs=');
+var_dump(mb_ereg_match($regex1, $string_mb, b'i'));
+
+echo "\n-- Multibyte string 2 --\n";
+$regex2 = base64_decode('5LiW55WM');
+var_dump(mb_ereg_match($regex2, $string_mb));
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing mb_ereg_match() : basic functionality ***
+
+-- ASCII string 1 --
+bool(true)
+
+-- ASCII string 2 --
+bool(false)
+
+-- Multibyte string 1 --
+bool(true)
+
+-- Multibyte string 2 --
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_ereg_match_error1.phpt b/ext/mbstring/tests/mb_ereg_match_error1.phpt
new file mode 100644
index 0000000000..b36c68621b
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_match_error1.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test mb_ereg_match() function : error conditions - pass function incorrect number of arguments
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_match') or die("skip mb_ereg_match() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : bool mb_ereg_match(string $pattern, string $string [,string $option])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test mb_ereg_match by passing an incorrect number of arguments
+ */
+
+echo "*** Testing mb_ereg_match() : error conditions ***\n";
+
+
+//Test mb_ereg_match with one more than the expected number of arguments
+echo "\n-- Testing mb_ereg_match() function with more than expected no. of arguments --\n";
+$pattern = b'string_val';
+$string = b'string_val';
+$option = 'string_val';
+$extra_arg = 10;
+var_dump( mb_ereg_match($pattern, $string, $option, $extra_arg) );
+
+// Testing mb_ereg_match with one less than the expected number of arguments
+echo "\n-- Testing mb_ereg_match() function with less than expected no. of arguments --\n";
+$pattern = b'string_val';
+var_dump( mb_ereg_match($pattern) );
+
+// Testing mb_ereg_match with zero arguments
+echo "\n-- Testing mb_ereg_match() function with zero arguments --\n";
+var_dump( mb_ereg_match() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_match() : error conditions ***
+
+-- Testing mb_ereg_match() function with more than expected no. of arguments --
+
+Warning: mb_ereg_match() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing mb_ereg_match() function with less than expected no. of arguments --
+
+Warning: mb_ereg_match() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing mb_ereg_match() function with zero arguments --
+
+Warning: mb_ereg_match() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_replace_basic.phpt b/ext/mbstring/tests/mb_ereg_replace_basic.phpt
new file mode 100644
index 0000000000..fe382865c6
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_basic.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test mb_ereg_replace() function : basic
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_ereg_replace(string $pattern, string $replacement,
+ * string $string [, string o$ption])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test Basic Functionality of mb_ereg_replace()
+ */
+
+echo "*** Testing mb_ereg_replace() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+mb_regex_encoding('UTF-8');
+
+$string_ascii = b'abc def';
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string 1 --\n";
+$result_1 = mb_ereg_replace(b'(.*)def', b'\\1 123', $string_ascii);
+var_dump(bin2hex($result_1));
+
+echo "\n-- ASCII string 2 --\n";
+$result_2 = mb_ereg_replace(b'123', b'abc', $string_ascii);
+var_dump(bin2hex($result_2));
+
+echo "\n-- Multibyte string 1 --\n";
+$regex1 = base64_decode('KOaXpeacrOiqnikuKj8oWzEtOV0rKQ=='); //Japanese regex in UTF-8
+$result_3 = mb_ereg_replace($regex1, b'\\1_____\\2', $string_mb);
+var_dump(bin2hex($result_3));
+
+echo "\n-- Multibyte string 2 --\n";
+$regex2 = base64_decode('5LiW55WM');
+$result_4 = mb_ereg_replace($regex2, b'_____', $string_mb);
+var_dump(bin2hex($result_4));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing mb_ereg_replace() : basic functionality ***
+
+-- ASCII string 1 --
+unicode(16) "6162632020313233"
+
+-- ASCII string 2 --
+unicode(14) "61626320646566"
+
+-- Multibyte string 1 --
+unicode(72) "e697a5e69cace8aa9e5f5f5f5f5f31323334efbc95efbc96efbc97efbc98efbc99e38082"
+
+-- Multibyte string 2 --
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_replace_error.phpt b/ext/mbstring/tests/mb_ereg_replace_error.phpt
new file mode 100644
index 0000000000..ee56f043f1
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_error.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test mb_ereg_replace() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_ereg_replace() : error conditions ***\n";
+
+
+//Test mb_ereg_replace with one more than the expected number of arguments
+echo "\n-- Testing mb_ereg_replace() function with more than expected no. of arguments --\n";
+$pattern = b'[a-k]';
+$replacement = b'1';
+$string = b'string_val';
+$option = '';
+$extra_arg = 10;
+var_dump( mb_ereg_replace($pattern, $replacement, $string, $option, $extra_arg) );
+
+// Testing mb_ereg_replace with one less than the expected number of arguments
+echo "\n-- Testing mb_ereg_replace() function with less than expected no. of arguments --\n";
+$pattern = b'string_val';
+$replacement = b'string_val';
+var_dump( mb_ereg_replace($pattern, $replacement) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_replace() : error conditions ***
+
+-- Testing mb_ereg_replace() function with more than expected no. of arguments --
+
+Warning: mb_ereg_replace() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_ereg_replace() function with less than expected no. of arguments --
+
+Warning: mb_ereg_replace() expects at least 3 parameters, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
new file mode 100644
index 0000000000..195910794a
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Test mb_ereg_replace() function : usage variations - <type here specifics of this variation>
+--INI--
+error_reporting=E_ALL & ~E_NOTICE
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$replacement = 'string_val';
+$string = 'string_val';
+$option = '';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg_replace($input, $replacement, $string, $option) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_replace() : usage variations ***
+
+-- Iteration 1 --
+string(10) "string_val"
+
+-- Iteration 2 --
+string(10) "string_val"
+
+-- Iteration 3 --
+string(10) "string_val"
+
+-- Iteration 4 --
+string(10) "string_val"
+
+-- Iteration 5 --
+string(10) "string_val"
+
+-- Iteration 6 --
+string(10) "string_val"
+
+-- Iteration 7 --
+string(10) "string_val"
+
+-- Iteration 8 --
+string(10) "string_val"
+
+-- Iteration 9 --
+string(10) "string_val"
+
+-- Iteration 10 --
+string(10) "string_val"
+
+-- Iteration 11 --
+string(10) "string_val"
+
+-- Iteration 12 --
+string(10) "string_val"
+
+-- Iteration 13 --
+string(10) "string_val"
+
+-- Iteration 14 --
+string(10) "string_val"
+
+-- Iteration 15 --
+string(10) "string_val"
+
+-- Iteration 16 --
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
+
+-- Iteration 17 --
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
+
+-- Iteration 18 --
+string(10) "string_val"
+
+-- Iteration 19 --
+string(10) "string_val"
+
+-- Iteration 20 --
+string(10) "string_val"
+
+-- Iteration 21 --
+string(10) "string_val"
+
+-- Iteration 22 --
+string(10) "string_val"
+
+-- Iteration 23 --
+string(10) "string_val"
+Done
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation2.phpt b/ext/mbstring/tests/mb_ereg_replace_variation2.phpt
new file mode 100644
index 0000000000..31ea14199a
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_variation2.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test mb_ereg_replace() function : usage variations
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[a-z]';
+$string = 'string_val';
+$option = '';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg_replace($pattern, $input, $string, $option) );
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_replace() : usage variations ***
+
+-- Iteration 1 --
+string(10) "000000_000"
+
+-- Iteration 2 --
+string(10) "111111_111"
+
+-- Iteration 3 --
+string(46) "123451234512345123451234512345_123451234512345"
+
+-- Iteration 4 --
+string(46) "-2345-2345-2345-2345-2345-2345_-2345-2345-2345"
+
+-- Iteration 5 --
+string(37) "10.510.510.510.510.510.5_10.510.510.5"
+
+-- Iteration 6 --
+string(46) "-10.5-10.5-10.5-10.5-10.5-10.5_-10.5-10.5-10.5"
+
+-- Iteration 7 --
+string(109) "123456789000123456789000123456789000123456789000123456789000123456789000_123456789000123456789000123456789000"
+
+-- Iteration 8 --
+string(118) "1.23456789E-91.23456789E-91.23456789E-91.23456789E-91.23456789E-91.23456789E-9_1.23456789E-91.23456789E-91.23456789E-9"
+
+-- Iteration 9 --
+string(28) "0.50.50.50.50.50.5_0.50.50.5"
+
+-- Iteration 10 --
+string(1) "_"
+
+-- Iteration 11 --
+string(1) "_"
+
+-- Iteration 12 --
+string(10) "111111_111"
+
+-- Iteration 13 --
+string(1) "_"
+
+-- Iteration 14 --
+string(10) "111111_111"
+
+-- Iteration 15 --
+string(1) "_"
+
+-- Iteration 16 --
+string(1) "_"
+
+-- Iteration 17 --
+string(1) "_"
+
+-- Iteration 18 --
+string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
+
+-- Iteration 19 --
+string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
+
+-- Iteration 20 --
+string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
+
+-- Iteration 21 --
+string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
+
+-- Iteration 22 --
+string(1) "_"
+
+-- Iteration 23 --
+string(1) "_"
+
+-- Iteration 24 --
+
+Warning: mb_ereg_replace() expects parameter 2 to be binary string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation3.phpt b/ext/mbstring/tests/mb_ereg_replace_variation3.phpt
new file mode 100644
index 0000000000..191091e097
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_variation3.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_ereg_replace() function : usage variations
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[a-z]';
+$replacement = 'string_val';
+$option = '';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg_replace($pattern, $replacement, $input, $option) );
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_replace() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "123456789000"
+
+-- Iteration 8 --
+string(13) "1.23456789E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+string(0) ""
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(1) "1"
+
+-- Iteration 13 --
+string(0) ""
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(5) "UTF-8"
+
+-- Iteration 19 --
+string(5) "UTF-8"
+
+-- Iteration 20 --
+string(5) "UTF-8"
+
+-- Iteration 21 --
+string(5) "UTF-8"
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+
+Warning: mb_ereg_replace() expects parameter 3 to be binary string, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation4.phpt b/ext/mbstring/tests/mb_ereg_replace_variation4.phpt
new file mode 100644
index 0000000000..b40efbc093
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_replace_variation4.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_ereg_replace() function : usage variations
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
+ * Description: Replace regular expression for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[a-k]';
+$replacement = '1';
+$string = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg_replace($pattern, $replacement, $string, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg_replace() : usage variations ***
+
+-- Iteration 1 --
+string(10) "str1n1_v1l"
+
+-- Iteration 2 --
+string(10) "str1n1_v1l"
+
+-- Iteration 3 --
+string(10) "str1n1_v1l"
+
+-- Iteration 4 --
+string(10) "str1n1_v1l"
+
+-- Iteration 5 --
+string(10) "str1n1_v1l"
+
+-- Iteration 6 --
+string(10) "str1n1_v1l"
+
+-- Iteration 7 --
+string(10) "str1n1_v1l"
+
+-- Iteration 8 --
+string(10) "str1n1_v1l"
+
+-- Iteration 9 --
+string(10) "str1n1_v1l"
+
+-- Iteration 10 --
+string(10) "str1n1_v1l"
+
+-- Iteration 11 --
+string(10) "str1n1_v1l"
+
+-- Iteration 12 --
+string(10) "str1n1_v1l"
+
+-- Iteration 13 --
+string(10) "str1n1_v1l"
+
+-- Iteration 14 --
+string(10) "str1n1_v1l"
+
+-- Iteration 15 --
+string(10) "str1n1_v1l"
+
+-- Iteration 16 --
+string(10) "str1n1_v1l"
+
+-- Iteration 17 --
+string(10) "str1n1_v1l"
+
+-- Iteration 18 --
+string(10) "str1n1_v1l"
+
+-- Iteration 19 --
+string(10) "str1n1_v1l"
+
+-- Iteration 20 --
+string(10) "str1n1_v1l"
+
+-- Iteration 21 --
+string(10) "str1n1_v1l"
+
+-- Iteration 22 --
+string(10) "str1n1_v1l"
+
+-- Iteration 23 --
+string(10) "str1n1_v1l"
+
+-- Iteration 24 --
+
+Warning: mb_ereg_replace() expects parameter 4 to be binary string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation3.phpt b/ext/mbstring/tests/mb_ereg_variation3.phpt
index c0cf1de8f7..2f53e0c85c 100644
--- a/ext/mbstring/tests/mb_ereg_variation3.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation3.phpt
@@ -21,18 +21,18 @@ echo "*** Testing mb_ereg() : variation ***\n";
mb_regex_encoding('utf-8'); // have to set otherwise won't match $mb properly
$mb = base64_decode('5pel5pys6Kqe');
-$character_classes = array ('aB1' => '[[:alnum:]]+', /*1*/
- 'aBcD' => '[[:alpha:]]+',
- 'ab/=' => '[[:ascii:]]+',
- " \t" => '[[:blank:]]+',
- '234' => '[[:digit:]]+', /*5*/
- "$mb" => '[[:graph:]]+',
- 'fjds' => '[[:lower:]]+',
- "$mb\t" => '[[:print:]]+',
- '.!"*@' => '[[:punct:]]+',
- "\t" => '[[:space:]]+', /*10*/
- 'IDSJV' => '[[:upper:]]+',
- '3b5D' => '[[:xdigit:]]+'); /*12*/
+$character_classes = array (b'aB1' => b'[[:alnum:]]+', /*1*/
+ b'aBcD' => b'[[:alpha:]]+',
+ b'ab/=' => b'[[:ascii:]]+',
+ b" \t" => b'[[:blank:]]+',
+ b'234' => b'[[:digit:]]+', /*5*/
+ "$mb" => b'[[:graph:]]+',
+ b'fjds' => b'[[:lower:]]+',
+ b"$mb\t" => b'[[:print:]]+',
+ b'.!"*@' => b'[[:punct:]]+',
+ b"\t" => b'[[:space:]]+', /*10*/
+ b'IDSJV' => b'[[:upper:]]+',
+ b'3b5D' => b'[[:xdigit:]]+'); /*12*/
$iterator = 1;
foreach($character_classes as $string => $pattern) {
@@ -42,11 +42,7 @@ foreach($character_classes as $string => $pattern) {
// make sure any multibyte output is in base 64
echo "\n-- Iteration $iterator --\n";
var_dump(mb_ereg($pattern, $string, $regs));
- if (strpos($string, $mb) === FALSE) {
- var_dump($regs);
- } else {
- base64_encode_var_dump($regs);
- }
+ base64_encode_var_dump($regs);
$iterator++;
}
/**
@@ -59,7 +55,7 @@ function base64_encode_var_dump($regs) {
echo "array(" . count($regs) . ") {\n";
foreach ($regs as $key => $value) {
echo " [$key]=>\n ";
- if (is_string($value)) {
+ if (is_unicode($value)) {
var_dump(base64_encode($value));
} else {
var_dump($value);
@@ -116,7 +112,7 @@ array(1) {
int(9)
array(1) {
[0]=>
- string(12) "5pel5pys6Kqe"
+ string(9) "日本語"
}
-- Iteration 7 --
@@ -130,7 +126,7 @@ array(1) {
int(10)
array(1) {
[0]=>
- string(16) "5pel5pys6KqeCQ=="
+ string(10) "日本語 "
}
-- Iteration 9 --
@@ -161,3 +157,4 @@ array(1) {
string(4) "3b5D"
}
Done
+
diff --git a/ext/mbstring/tests/mb_ereg_variation4.phpt b/ext/mbstring/tests/mb_ereg_variation4.phpt
index 66b31da81b..2916b1b5bc 100644
--- a/ext/mbstring/tests/mb_ereg_variation4.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation4.phpt
@@ -23,19 +23,19 @@ mb_regex_encoding('utf-8');
//contains japanese characters, ASCII digits and different, UTF-8 encoded digits
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
-$character_classes = array ('[[:alnum:]]+', /*1*/
- '[[:alpha:]]+',
- '[[:ascii:]]+',
- '[[:blank:]]+',
- '[[:cntrl:]]+',/*5*/
- '[[:digit:]]+',
- '[[:graph:]]+',
- '[[:lower:]]+',
- '[[:print:]]+',
- '[[:punct:]]+', /*10*/
- '[[:space:]]+',
- '[[:upper:]]+',
- '[[:xdigit:]]+'); /*13*/
+$character_classes = array (b'[[:alnum:]]+', /*1*/
+ b'[[:alpha:]]+',
+ b'[[:ascii:]]+',
+ b'[[:blank:]]+',
+ b'[[:cntrl:]]+',/*5*/
+ b'[[:digit:]]+',
+ b'[[:graph:]]+',
+ b'[[:lower:]]+',
+ b'[[:print:]]+',
+ b'[[:punct:]]+', /*10*/
+ b'[[:space:]]+',
+ b'[[:upper:]]+',
+ b'[[:xdigit:]]+'); /*13*/
$iterator = 1;
foreach ($character_classes as $pattern) {
@@ -59,7 +59,7 @@ function base64_encode_var_dump($regs) {
echo "array(" . count($regs) . ") {\n";
foreach ($regs as $key => $value) {
echo " [$key]=>\n ";
- if (is_string($value)) {
+ if (is_unicode($value)) {
var_dump(base64_encode($value));
} else {
var_dump($value);
@@ -73,28 +73,28 @@ function base64_encode_var_dump($regs) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_ereg() : usage variations ***
-- Iteration 1 --
int(47)
array(1) {
[0]=>
- string(64) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJk="
+ string(47) "日本語テキストã§ã™0123456789"
}
-- Iteration 2 --
int(27)
array(1) {
[0]=>
- string(36) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ"
+ string(27) "日本語テキストã§ã™"
}
-- Iteration 3 --
int(5)
array(1) {
[0]=>
- string(8) "MDEyMzQ="
+ string(5) "01234"
}
-- Iteration 4 --
@@ -107,14 +107,14 @@ bool(false)
int(20)
array(1) {
[0]=>
- string(28) "MDEyMzTvvJXvvJbvvJfvvJjvvJk="
+ string(20) "0123456789"
}
-- Iteration 7 --
int(50)
array(1) {
[0]=>
- string(68) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+ string(50) "日本語テキストã§ã™0123456789。"
}
-- Iteration 8 --
@@ -124,14 +124,14 @@ bool(false)
int(50)
array(1) {
[0]=>
- string(68) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+ string(50) "日本語テキストã§ã™0123456789。"
}
-- Iteration 10 --
int(3)
array(1) {
[0]=>
- string(4) "44CC"
+ string(3) "。"
}
-- Iteration 11 --
@@ -144,6 +144,7 @@ bool(false)
int(5)
array(1) {
[0]=>
- string(8) "MDEyMzQ="
+ string(5) "01234"
}
Done
+
diff --git a/ext/mbstring/tests/mb_ereg_variation5.phpt b/ext/mbstring/tests/mb_ereg_variation5.phpt
index 61c8dbcd60..0bddf289f7 100644
--- a/ext/mbstring/tests/mb_ereg_variation5.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation5.phpt
@@ -20,16 +20,16 @@ echo "*** Testing mb_ereg() : usage variations ***\n";
mb_regex_encoding('utf-8');
-$string_ascii = 'This is an English string. 0123456789.';
+$string_ascii = b'This is an English string. 0123456789.';
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
-$regex = '^.*?[[:blank:]]?[[:punct:][:digit:]]+\.?$';
+$regex = b'^.*?[[:blank:]]?[[:punct:][:digit:]]+\.?$';
echo "\nASCII String without \$regs arg:\t\t";
var_dump(mb_ereg($regex, $string_ascii));
echo "ASCII String with \$regs arg:\n";
var_dump(mb_ereg($regex, $string_ascii, $regs_ascii));
-var_dump($regs_ascii);
+base64_encode_var_dump($regs_ascii);
echo "\nMultibyte String without \$regs arg:\t";
var_dump(mb_ereg($regex, $string_mb));
@@ -49,7 +49,7 @@ function base64_encode_var_dump($regs) {
echo "array(" . count($regs) . ") {\n";
foreach ($regs as $key => $value) {
echo " [$key]=>\n ";
- if (is_string($value)) {
+ if (is_unicode($value)) {
var_dump(base64_encode($value));
} else {
var_dump($value);
@@ -61,7 +61,7 @@ function base64_encode_var_dump($regs) {
}
}
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_ereg() : usage variations ***
ASCII String without $regs arg: int(1)
@@ -77,6 +77,7 @@ Multubyte String with $regs arg:
int(53)
array(1) {
[0]=>
- string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+ string(53) "日本語テキストã§ã™ã€‚0123456789。"
}
Done
+
diff --git a/ext/mbstring/tests/mb_ereg_variation6.phpt b/ext/mbstring/tests/mb_ereg_variation6.phpt
index abfc73f3dd..472f0759ec 100644
--- a/ext/mbstring/tests/mb_ereg_variation6.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation6.phpt
@@ -24,20 +24,27 @@ if(mb_regex_encoding('utf-8') == true) {
echo "Could not set regex encoding to utf-8\n";
}
-$regex_char = array ('\w+', '\W+', '\s+', '\S+', '\d+', '\D+', '\b', '\B');
-
-$string_ascii = 'This is an English string. 0123456789.';
+$regex_char = array ('\w+' => b'\w+',
+ '\W+' => b'\W+',
+ '\s+' => b'\s+',
+ '\S+' => b'\S+',
+ '\d+' => b'\d+',
+ '\D+' => b'\D+',
+ '\b' => b'\b',
+ '\B' => b'\B');
+
+$string_ascii = b'This is an English string. 0123456789.';
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
-foreach ($regex_char as $char) {
- echo "\n--** Pattern is: $char **--\n";
+foreach ($regex_char as $displayChar => $char) {
+ echo "\n--** Pattern is: $displayChar **--\n";
if (@$regs_ascii || @$regs_mb) {
$regs_ascii = null;
$regs_mb = null;
}
echo "-- ASCII String: --\n";
var_dump(mb_ereg($char, $string_ascii, $regs_ascii));
- var_dump($regs_ascii);
+ base64_encode_var_dump($regs_ascii);
echo "-- Multibyte String: --\n";
var_dump(mb_ereg($char, $string_mb, $regs_mb));
@@ -55,7 +62,7 @@ function base64_encode_var_dump($regs) {
echo "array(" . count($regs) . ") {\n";
foreach ($regs as $key => $value) {
echo " [$key]=>\n ";
- if (is_string($value)) {
+ if (is_unicode($value)) {
var_dump(base64_encode($value));
} else {
var_dump($value);
@@ -85,7 +92,7 @@ array(1) {
int(27)
array(1) {
[0]=>
- string(36) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ"
+ string(27) "日本語テキストã§ã™"
}
--** Pattern is: \W+ **--
@@ -99,7 +106,7 @@ array(1) {
int(3)
array(1) {
[0]=>
- string(4) "44CC"
+ string(3) "。"
}
--** Pattern is: \s+ **--
@@ -124,7 +131,7 @@ array(1) {
int(53)
array(1) {
[0]=>
- string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+ string(53) "日本語テキストã§ã™ã€‚0123456789。"
}
--** Pattern is: \d+ **--
@@ -138,7 +145,7 @@ array(1) {
int(20)
array(1) {
[0]=>
- string(28) "MDEyMzTvvJXvvJbvvJfvvJjvvJk="
+ string(20) "0123456789"
}
--** Pattern is: \D+ **--
@@ -152,7 +159,7 @@ array(1) {
int(30)
array(1) {
[0]=>
- string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
+ string(30) "日本語テキストã§ã™ã€‚"
}
--** Pattern is: \b **--
@@ -183,3 +190,4 @@ array(1) {
bool(false)
}
Done
+
diff --git a/ext/mbstring/tests/mb_ereg_variation7.phpt b/ext/mbstring/tests/mb_ereg_variation7.phpt
index 408d9078b7..366aa743b6 100644
--- a/ext/mbstring/tests/mb_ereg_variation7.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation7.phpt
@@ -27,10 +27,10 @@ if(mb_regex_encoding('utf-8') == true) {
echo "Could not set regex encoding to utf-8\n";
}
-$string_ascii = 'This is an English string. 0123456789.';
-$regex_ascii = '([A-Z]\w{1,4}is( [aeiou]|h)) ?.*\.\s[0-9]+(5([6-9][79]){2})[[:punct:]]$';
+$string_ascii = b'This is an English string. 0123456789.';
+$regex_ascii = b'([A-Z]\w{1,4}is( [aeiou]|h)) ?.*\.\s[0-9]+(5([6-9][79]){2})[[:punct:]]$';
var_dump(mb_ereg($regex_ascii, $string_ascii, $regs_ascii));
-var_dump($regs_ascii);
+base64_encode_var_dump($regs_ascii);
$string_mb = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
$regex_mb = base64_decode("W86RLc6pXShcdysgKSvOtVvOsS3PiVxzXSvOui4qKM+MfM6/KS4qXC5cc1swLTldKyg1KFs2LTldWzc5XSl7Mn0pW1s6cHVuY3Q6XV0k");
@@ -47,7 +47,7 @@ function base64_encode_var_dump($regs) {
echo "array(" . count($regs) . ") {\n";
foreach ($regs as $key => $value) {
echo " [$key]=>\n ";
- if (is_string($value)) {
+ if (is_unicode($value)) {
var_dump(base64_encode($value));
} else {
var_dump($value);
@@ -81,14 +81,15 @@ array(5) {
int(64)
array(5) {
[0]=>
- string(88) "zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg=="
+ string(64) "Αυτό είναι ελληνικό κείμενο. 0123456789."
[1]=>
- string(16) "zrXOr869zrHOuSA="
+ string(11) "είναι "
[2]=>
- string(4) "zr8="
+ string(2) "ο"
[3]=>
- string(8) "NTY3ODk="
+ string(5) "56789"
[4]=>
- string(4) "ODk="
+ string(2) "89"
}
Done
+
diff --git a/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt
new file mode 100644
index 0000000000..241e1a6929
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test INI mbstring.internal_encoding basic - encoding when valid specified
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stripos') or die("skip mb_stripos() is not available in this build");
+?>
+--INI--
+mbstring.internal_encoding=ISO-8859-7
+--FILE--
+<?php
+
+echo "*** Testing INI mbstring.internal_encoding : basic functionality ***\n";
+
+echo mb_internal_encoding()."\n";
+echo ini_get('mbstring.internal_encoding')."\n";
+mb_internal_encoding('UTF-8');
+echo mb_internal_encoding()."\n";
+echo ini_get('mbstring.internal_encoding')."\n";
+
+?>
+===DONE===
+--EXPECT--
+*** Testing INI mbstring.internal_encoding : basic functionality ***
+ISO-8859-7
+ISO-8859-7
+UTF-8
+ISO-8859-7
+===DONE===
diff --git a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
index 704c5e5f37..d04aacd195 100644
--- a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
+++ b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
@@ -91,77 +91,89 @@ echo "Done";
*** Testing mb_regex_encoding() : usage variations ***
-- Iteration 1 --
-string(%d) "%s"
+string(10) "ISO-8859-1"
bool(true)
string(5) "UCS-4"
-- Iteration 2 --
string(5) "UCS-4"
-bool(true)
-string(7) "UCS-4BE"
+
+Warning: mb_regex_encoding(): Unknown encoding "UCS-4BE" in %s on line %d
+bool(false)
+string(5) "UCS-4"
-- Iteration 3 --
-string(7) "UCS-4BE"
+string(5) "UCS-4"
bool(true)
string(7) "UCS-4LE"
-- Iteration 4 --
string(7) "UCS-4LE"
-bool(true)
-string(5) "UCS-2"
+
+Warning: mb_regex_encoding(): Unknown encoding "UCS-2" in %s on line %d
+bool(false)
+string(7) "UCS-4LE"
-- Iteration 5 --
-string(5) "UCS-2"
-bool(true)
-string(7) "UCS-2BE"
+string(7) "UCS-4LE"
+
+Warning: mb_regex_encoding(): Unknown encoding "UCS-2BE" in %s on line %d
+bool(false)
+string(7) "UCS-4LE"
-- Iteration 6 --
-string(7) "UCS-2BE"
-bool(true)
-string(7) "UCS-2LE"
+string(7) "UCS-4LE"
+
+Warning: mb_regex_encoding(): Unknown encoding "UCS-2LE" in %s on line %d
+bool(false)
+string(7) "UCS-4LE"
-- Iteration 7 --
-string(7) "UCS-2LE"
+string(7) "UCS-4LE"
bool(true)
-string(6) "UTF-32"
+string(5) "UCS-4"
-- Iteration 8 --
-string(6) "UTF-32"
+string(5) "UCS-4"
bool(true)
-string(8) "UTF-32BE"
+string(5) "UCS-4"
-- Iteration 9 --
-string(8) "UTF-32BE"
+string(5) "UCS-4"
bool(true)
-string(8) "UTF-32LE"
+string(7) "UCS-4LE"
-- Iteration 10 --
-string(8) "UTF-32LE"
+string(7) "UCS-4LE"
bool(true)
string(6) "UTF-16"
-- Iteration 11 --
string(6) "UTF-16"
bool(true)
-string(8) "UTF-16BE"
+string(6) "UTF-16"
-- Iteration 12 --
-string(8) "UTF-16BE"
+string(6) "UTF-16"
bool(true)
string(8) "UTF-16LE"
-- Iteration 13 --
string(8) "UTF-16LE"
-bool(true)
-string(5) "UTF-7"
+
+Warning: mb_regex_encoding(): Unknown encoding "UTF-7" in %s on line %d
+bool(false)
+string(8) "UTF-16LE"
-- Iteration 14 --
-string(5) "UTF-7"
-bool(true)
-string(9) "UTF7-IMAP"
+string(8) "UTF-16LE"
+
+Warning: mb_regex_encoding(): Unknown encoding "UTF7-IMAP" in %s on line %d
+bool(false)
+string(8) "UTF-16LE"
-- Iteration 15 --
-string(9) "UTF7-IMAP"
+string(8) "UTF-16LE"
bool(true)
string(5) "UTF-8"
@@ -198,12 +210,14 @@ bool(false)
string(4) "SJIS"
-- Iteration 22 --
-string(11) "SJIS"
-bool(true)
-string(3) "JIS"
+string(4) "SJIS"
+
+Warning: mb_regex_encoding(): Unknown encoding "JIS" in %s on line %d
+bool(false)
+string(4) "SJIS"
-- Iteration 23 --
-string(3) "JIS"
+string(4) "SJIS"
bool(true)
string(10) "ISO-8859-1"
@@ -269,106 +283,139 @@ string(11) "ISO-8859-15"
-- Iteration 36 --
string(11) "ISO-8859-15"
-bool(true)
-string(7) "byte2be"
+
+Warning: mb_regex_encoding(): Unknown encoding "byte2be" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 37 --
-string(7) "byte2be"
-bool(true)
-string(7) "byte2le"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "byte2le" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 38 --
-string(7) "byte2le"
-bool(true)
-string(7) "byte4be"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "byte4be" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 39 --
-string(7) "byte4be"
-bool(true)
-string(7) "byte4le"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "byte4le" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 40 --
-string(7) "byte4le"
-bool(true)
-string(6) "BASE64"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "BASE64" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 41 --
-string(6) "BASE64"
-bool(true)
-string(13) "HTML-ENTITIES"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "HTML-ENTITIES" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 42 --
-string(13) "HTML-ENTITIES"
-bool(true)
-string(4) "7bit"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "7bit" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 43 --
-string(4) "7bit"
-bool(true)
-string(4) "8bit"
+string(11) "ISO-8859-15"
+
+Warning: mb_regex_encoding(): Unknown encoding "8bit" in %s on line %d
+bool(false)
+string(11) "ISO-8859-15"
-- Iteration 44 --
-string(4) "8bit"
+string(11) "ISO-8859-15"
bool(true)
string(6) "EUC-CN"
-- Iteration 45 --
string(6) "EUC-CN"
-bool(true)
-string(5) "CP936"
+
+Warning: mb_regex_encoding(): Unknown encoding "CP936" in %s on line %d
+bool(false)
+string(6) "EUC-CN"
-- Iteration 46 --
-string(5) "CP936"
-bool(true)
-string(2) "HZ"
+string(6) "EUC-CN"
+
+Warning: mb_regex_encoding(): Unknown encoding "HZ" in %s on line %d
+bool(false)
+string(6) "EUC-CN"
-- Iteration 47 --
-string(2) "HZ"
+string(6) "EUC-CN"
bool(true)
string(6) "EUC-TW"
-- Iteration 48 --
string(6) "EUC-TW"
-bool(true)
-string(5) "CP950"
+
+Warning: mb_regex_encoding(): Unknown encoding "CP950" in %s on line %d
+bool(false)
+string(6) "EUC-TW"
-- Iteration 49 --
-string(5) "CP950"
+string(6) "EUC-TW"
bool(true)
-string(5) "BIG5"
+string(4) "BIG5"
-- Iteration 50 --
-string(5) "BIG5"
+string(4) "BIG5"
bool(true)
string(6) "EUC-KR"
-- Iteration 51 --
string(6) "EUC-KR"
-bool(true)
-string(3) "UHC"
+
+Warning: mb_regex_encoding(): Unknown encoding "UHC" in %s on line %d
+bool(false)
+string(6) "EUC-KR"
-- Iteration 52 --
-string(3) "UHC"
-bool(true)
-string(11) "ISO-2022-KR"
+string(6) "EUC-KR"
+
+Warning: mb_regex_encoding(): Unknown encoding "ISO-2022-KR" in %s on line %d
+bool(false)
+string(6) "EUC-KR"
-- Iteration 53 --
-string(11) "ISO-2022-KR"
-bool(true)
-string(12) "Windows-1251"
+string(6) "EUC-KR"
+
+Warning: mb_regex_encoding(): Unknown encoding "Windows-1251" in %s on line %d
+bool(false)
+string(6) "EUC-KR"
-- Iteration 54 --
-string(12) "Windows-1251"
-bool(true)
-string(12) "Windows-1252"
+string(6) "EUC-KR"
+
+Warning: mb_regex_encoding(): Unknown encoding "Windows-1252" in %s on line %d
+bool(false)
+string(6) "EUC-KR"
-- Iteration 55 --
-string(12) "Windows-1252"
-bool(true)
-string(5) "CP866"
+string(6) "EUC-KR"
+
+Warning: mb_regex_encoding(): Unknown encoding "CP866" in %s on line %d
+bool(false)
+string(6) "EUC-KR"
-- Iteration 56 --
-string(5) "CP866"
+string(6) "EUC-KR"
bool(true)
-string(6) "KOI8-R"
-Done \ No newline at end of file
+string(5) "KOI8R"
+Done
+
diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt
index abe12763eb..cd43caa2b3 100644
--- a/ext/mbstring/tests/mb_split.phpt
+++ b/ext/mbstring/tests/mb_split.phpt
@@ -23,19 +23,19 @@ mbstring.func_overload=0
}
}
- var_dump( mb_split( " ", "a b c d e f g" )
- == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) );
+ var_dump( mb_split( b" ", b"a b c d e f g" )
+ == mb_split( b"[[:space:]]", b"a\nb\tc\nd e f g" ) );
for ( $i = 0; $i < 5; ++$i ) {
- verify_split( " ", "a\tb\tc\td e\tf g", $i );
+ verify_split( b" ", b"a\tb\tc\td e\tf g", $i );
}
for ( $i = 1; $i < 5; ++$i ) {
- verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
+ verify_split( b"\xa1\xa1+", b"\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
}
?>
---EXPECT--
+--EXPECTF--
bool(true)
ok
ok
@@ -46,3 +46,4 @@ ok
2-2
3-3
4-4
+
diff --git a/ext/mbstring/tests/mb_split_error.phpt b/ext/mbstring/tests/mb_split_error.phpt
new file mode 100644
index 0000000000..b48e21520b
--- /dev/null
+++ b/ext/mbstring/tests/mb_split_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test mb_split() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_split') or die("skip mb_split() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto array mb_split(string pattern, string string [, int limit])
+ * Description: split multibyte string into array by regular expression
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * test too few and too many parameters
+ */
+
+echo "*** Testing mb_split() : error conditions ***\n";
+
+
+//Test mb_split with one more than the expected number of arguments
+echo "\n-- Testing mb_split() function with more than expected no. of arguments --\n";
+$pattern = ' ';
+$string = 'a b c d e f g';
+$limit = 0;
+$extra_arg = 10;
+var_dump( mb_split($pattern, $string, $limit, $extra_arg) );
+
+// Testing mb_split with one less than the expected number of arguments
+echo "\n-- Testing mb_split() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( mb_split($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_split() : error conditions ***
+
+-- Testing mb_split() function with more than expected no. of arguments --
+
+Warning: mb_split() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing mb_split() function with less than expected no. of arguments --
+
+Warning: mb_split() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_split_variation1.phpt b/ext/mbstring/tests/mb_split_variation1.phpt
new file mode 100644
index 0000000000..a857eae3ef
--- /dev/null
+++ b/ext/mbstring/tests/mb_split_variation1.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test mb_split() function : usage variations - different parameter types for pattern
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_split') or die("skip mb_split() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto array mb_split(string pattern, string string [, int limit])
+ * Description: split multibyte string into array by regular expression
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = 'a b c d e f g';
+$limit = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_split($input, $string, $limit) );
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_split() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 10 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 11 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 13 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 15 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 16 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 17 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 20 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 22 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 23 --
+
+Warning: mb_split(): Empty regular expression in %s on line %d
+array(1) {
+ [0]=>
+ string(13) "a b c d e f g"
+}
+
+-- Iteration 24 --
+
+Warning: mb_split() expects parameter 1 to be binary string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_split_variation2.phpt b/ext/mbstring/tests/mb_split_variation2.phpt
new file mode 100644
index 0000000000..a4493cb2c3
--- /dev/null
+++ b/ext/mbstring/tests/mb_split_variation2.phpt
@@ -0,0 +1,248 @@
+--TEST--
+Test mb_split() function : usage variations - different parameter types for string
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_split') or die("skip mb_split() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto array mb_split(string pattern, string string [, int limit])
+ * Description: split multibyte string into array by regular expression
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing mb_split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[a-z]';
+$limit = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_split($pattern, $input, $limit) );
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_split() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(5) "-2345"
+}
+
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(5) "-10.5"
+}
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(12) "123456789000"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(13) "1.23456789E-9"
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 16 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(5) "UTF-8"
+}
+
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(5) "UTF-8"
+}
+
+-- Iteration 20 --
+array(1) {
+ [0]=>
+ string(5) "UTF-8"
+}
+
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(5) "UTF-8"
+}
+
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 23 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 24 --
+
+Warning: mb_split() expects parameter 2 to be binary string, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_split_variation3.phpt b/ext/mbstring/tests/mb_split_variation3.phpt
new file mode 100644
index 0000000000..97b859956d
--- /dev/null
+++ b/ext/mbstring/tests/mb_split_variation3.phpt
@@ -0,0 +1,336 @@
+--TEST--
+Test mb_split() function : usage variations - different parameter types for limit
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_split') or die("skip mb_split() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto array mb_split(string pattern, string string [, int limit])
+ * Description: split multibyte string into array by regular expression
+ * Source code: ext/mbstring/php_mbregex.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing mb_split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[a-z]';
+$string = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of the array for pattern
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_split($pattern, $string, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_split() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 3 --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) "_"
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+}
+
+-- Iteration 4 --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) "_"
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) "_"
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+}
+
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) "_"
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+}
+
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) "_"
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 16 --
+
+Warning: mb_split() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_split() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: mb_split() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: mb_split() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: mb_split() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: mb_split() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 23 --
+array(1) {
+ [0]=>
+ string(10) "string_val"
+}
+
+-- Iteration 24 --
+
+Warning: mb_split() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_stripos_basic.phpt b/ext/mbstring/tests/mb_stripos_basic.phpt
index ee62df7dcc..bb33bb1076 100644
--- a/ext/mbstring/tests/mb_stripos_basic.phpt
+++ b/ext/mbstring/tests/mb_stripos_basic.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -20,134 +21,138 @@ echo "*** Testing mb_stripos() : basic functionality***\n";
mb_internal_encoding('UTF-8');
-$string_ascii = 'abc def ABC DEF';
-//Japanese string in UTF-8
-$string_mb = '日本語テキストã§ã™ã€‚0123456789。';
-
-echo "\n-- ISO-8859-1 string 1 --\n";
-var_dump(mb_stripos($string_ascii, 'd', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 2 --\n";
-var_dump(mb_stripos($string_ascii, 'D', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 3 --\n";
-var_dump(mb_stripos($string_ascii, 'd', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 4 --\n";
-var_dump(mb_stripos($string_ascii, 'D', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 5 --\n";
-var_dump(mb_stripos($string_ascii, 'c', 4, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 6 --\n";
-var_dump(mb_stripos($string_ascii, 'c D', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 7 --\n";
-var_dump(mb_stripos($string_ascii, 'C d', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 8 --\n";
-var_dump(mb_stripos($string_ascii, 'deF', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 9 --\n";
-var_dump(mb_stripos($string_ascii, '123', 0, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 10 --\n";
-var_dump(mb_stripos($string_ascii, 'c D', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 11 --\n";
-var_dump(mb_stripos($string_ascii, 'C d', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 12 --\n";
-var_dump(mb_stripos($string_ascii, 'deF', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 13 --\n";
-var_dump(mb_stripos($string_ascii, '123', 1, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 14 --\n";
-var_dump(mb_stripos($string_ascii, 'c D', 4, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 15 --\n";
-var_dump(mb_stripos($string_ascii, 'C d', 4, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 16 --\n";
-var_dump(mb_stripos($string_ascii, 'deF', 4, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 17 --\n";
-var_dump(mb_stripos($string_ascii, 'deF', 5, 'ISO-8859-1'));
-
-echo "\n-- ISO-8859-1 string 18 --\n";
-var_dump(mb_stripos($string_ascii, '123', 4, 'ISO-8859-1'));
-
-echo "\n-- Multibyte string 1 --\n";
-$needle1 = '日本語';
-var_dump(mb_stripos($string_mb, $needle1));
-
-echo "\n-- Multibyte string 2 --\n";
-$needle2 = 'ã“ã‚“ã«ã¡ã¯ã€ä¸–ç•Œ';
-var_dump(mb_stripos($string_mb, $needle2));
+//ascii strings
+$ascii_haystacks = array(
+ b'abc defabc def',
+ b'ABC DEFABC DEF',
+ b'Abc dEFaBC Def',
+);
+
+$ascii_needles = array(
+ // 4 good ones
+ b'DE',
+ b'de',
+ b'De',
+ b'dE',
+
+ //flag a swap between good and bad
+ '!',
+
+ // 4 bad ones
+ b'df',
+ b'Df',
+ b'dF',
+ b'DF'
+);
+
+//greek strings in UTF-8
+$greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
+$greek_mixed = base64_decode('zrHOss6TzpTOlc6WzpfOmM65zrrOu868zr3Ovs6fzqDOoc6jzqTOpc+Gz4fPiM+J');
+$greek_haystacks = array($greek_lower, $greek_upper, $greek_mixed);
+
+$greek_nlower = base64_decode('zrzOvc6+zr8=');
+$greek_nupper = base64_decode('zpzOnc6ezp8=');
+$greek_nmixed1 = base64_decode('zpzOnc6+zr8=');
+$greek_nmixed2 = base64_decode('zrzOvc6+zp8=');
+
+$greek_blower = base64_decode('zpzOns6f');
+$greek_bupper = base64_decode('zrzOvs6/');
+$greek_bmixed1 = base64_decode('zpzOvs6/');
+$greek_bmixed2 = base64_decode('zrzOvs6f');
+$greek_needles = array(
+ // 4 good ones
+ $greek_nlower, $greek_nupper, $greek_nmixed1, $greek_nmixed2,
+
+ '!', // used to flag a swap between good and bad
+
+ // 4 bad ones
+ $greek_blower, $greek_bupper, $greek_bmixed1, $greek_bmixed2,
+);
+
+// try the basic options
+echo "\n -- ASCII Strings, needle should be found --\n";
+foreach ($ascii_needles as $needle) {
+ if ($needle == '!') {
+ echo "\n -- ASCII Strings, needle should not be found --\n";
+ }
+ else {
+ foreach ($ascii_haystacks as $haystack) {
+ var_dump(mb_stripos($haystack, $needle));
+ }
+ }
+}
+
+echo "\n -- Greek Strings, needle should be found --\n";
+foreach ($greek_needles as $needle) {
+ if ($needle == '!') {
+ echo "\n -- ASCII Strings, needle should not be found --\n";
+ }
+ else {
+ foreach ($greek_haystacks as $haystack) {
+ var_dump(mb_stripos($haystack, $needle));
+ }
+ }
+}
echo "Done";
?>
--EXPECTF--
*** Testing mb_stripos() : basic functionality***
--- ISO-8859-1 string 1 --
+ -- ASCII Strings, needle should be found --
+int(4)
+int(4)
+int(4)
+int(4)
+int(4)
int(4)
-
--- ISO-8859-1 string 2 --
int(4)
-
--- ISO-8859-1 string 3 --
int(4)
-
--- ISO-8859-1 string 4 --
int(4)
-
--- ISO-8859-1 string 5 --
-int(10)
-
--- ISO-8859-1 string 6 --
-int(2)
-
--- ISO-8859-1 string 7 --
-int(2)
-
--- ISO-8859-1 string 8 --
int(4)
-
--- ISO-8859-1 string 9 --
-bool(false)
-
--- ISO-8859-1 string 10 --
-int(2)
-
--- ISO-8859-1 string 11 --
-int(2)
-
--- ISO-8859-1 string 12 --
int(4)
-
--- ISO-8859-1 string 13 --
-bool(false)
-
--- ISO-8859-1 string 14 --
-int(10)
-
--- ISO-8859-1 string 15 --
-int(10)
-
--- ISO-8859-1 string 16 --
int(4)
--- ISO-8859-1 string 17 --
-int(12)
-
--- ISO-8859-1 string 18 --
+ -- ASCII Strings, needle should not be found --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
bool(false)
--- Multibyte string 1 --
-int(0)
-
--- Multibyte string 2 --
+ -- Greek Strings, needle should be found --
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+ -- ASCII Strings, needle should not be found --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
bool(false)
Done
diff --git a/ext/mbstring/tests/mb_stripos_basic2.phpt b/ext/mbstring/tests/mb_stripos_basic2.phpt
new file mode 100644
index 0000000000..f9131d9879
--- /dev/null
+++ b/ext/mbstring/tests/mb_stripos_basic2.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test mb_stripos() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stripos') or die("skip mb_stripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality of mb_stripos with ASCII and multibyte characters
+ */
+
+echo "*** Testing mb_stripos() : basic functionality***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii strings
+$ascii_haystacks = array(
+ b'abc defabc def',
+ b'ABC DEFABC DEF',
+ b'Abc dEFaBC Def',
+);
+
+$ascii_needles = array(
+ // 4 good ones
+ b'DE',
+ b'de',
+ b'De',
+ b'dE',
+);
+
+//greek strings in UTF-8
+$greek_lower = base64_decode('zrrOu868zr3Ovs6/z4DPgSDOus67zrzOvc6+zr/PgA==');
+$greek_upper = base64_decode('zprOm86czp3Ons6fzqDOoSDOms6bzpzOnc6ezp/OoA==');
+$greek_mixed = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA==');
+$greek_haystacks = array($greek_lower, $greek_upper, $greek_mixed);
+
+$greek_nlower = base64_decode('zrzOvc6+zr8=');
+$greek_nupper = base64_decode('zpzOnc6ezp8=');
+$greek_nmixed1 = base64_decode('zpzOnc6+zr8=');
+$greek_nmixed2 = base64_decode('zrzOvc6+zp8=');
+
+$greek_needles = array(
+ // 4 good ones
+ $greek_nlower, $greek_nupper, $greek_nmixed1, $greek_nmixed2,
+);
+
+// try the basic options
+echo "\n -- ASCII Strings --\n";
+foreach ($ascii_needles as $needle) {
+ foreach ($ascii_haystacks as $haystack) {
+ var_dump(mb_stripos($haystack, $needle));
+ var_dump(mb_stripos($haystack, $needle, 6));
+ }
+}
+
+echo "\n -- Greek Strings --\n";
+foreach ($greek_needles as $needle) {
+ foreach ($greek_haystacks as $haystack) {
+ var_dump(mb_stripos($haystack, $needle));
+ var_dump(mb_stripos($haystack, $needle, 4));
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_stripos() : basic functionality***
+
+ -- ASCII Strings --
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+int(4)
+int(13)
+
+ -- Greek Strings --
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+int(2)
+int(11)
+Done
+
diff --git a/ext/mbstring/tests/mb_stripos_error1.phpt b/ext/mbstring/tests/mb_stripos_error1.phpt
index cad623366f..c4ea5d7714 100644
--- a/ext/mbstring/tests/mb_stripos_error1.phpt
+++ b/ext/mbstring/tests/mb_stripos_error1.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -21,8 +22,8 @@ echo "*** Testing mb_stripos() : error conditions ***\n";
//Test mb_stripos with one more than the expected number of arguments
echo "\n-- Testing mb_stripos() function with more than expected no. of arguments --\n";
-$haystack = 'string_val';
-$needle = 'string_val';
+$haystack = b'string_val';
+$needle = b'string_val';
$offset = 10;
$encoding = 'string_val';
$extra_arg = 10;
@@ -30,7 +31,7 @@ var_dump( mb_stripos($haystack, $needle, $offset, $encoding, $extra_arg) );
// Testing mb_stripos with one less than the expected number of arguments
echo "\n-- Testing mb_stripos() function with less than expected no. of arguments --\n";
-$haystack = 'string_val';
+$haystack = b'string_val';
var_dump( mb_stripos($haystack) );
echo "Done";
diff --git a/ext/mbstring/tests/mb_stripos_error2.phpt b/ext/mbstring/tests/mb_stripos_error2.phpt
index 75e0e6d556..a24c5e4404 100644
--- a/ext/mbstring/tests/mb_stripos_error2.phpt
+++ b/ext/mbstring/tests/mb_stripos_error2.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -17,8 +18,8 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
*/
echo "*** Testing mb_stripos() : error conditions ***\n";
-$haystack = 'Hello, world';
-$needle = 'world';
+$haystack = b'Hello, world';
+$needle = b'world';
$offset = 2;
$encoding = 'unknown-encoding';
@@ -29,6 +30,9 @@ echo "Done";
--EXPECTF--
*** Testing mb_stripos() : error conditions ***
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_stripos_variation1.phpt b/ext/mbstring/tests/mb_stripos_variation1.phpt
index 411a939694..5c76f1c2be 100644
--- a/ext/mbstring/tests/mb_stripos_variation1.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation1.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -19,7 +20,7 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
echo "*** Testing mb_stripos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$needle = 'string_val';
+$needle = b'string_val';
$offset = 0;
$encoding = 'utf-8';
@@ -177,6 +178,6 @@ bool(false)
-- Iteration 24 --
-Warning: mb_stripos() expects parameter 1 to be string, resource given in %s on line %d
+Warning: mb_stripos() expects parameter 1 to be binary string, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_stripos_variation2.phpt b/ext/mbstring/tests/mb_stripos_variation2.phpt
index 630ba2ed85..67487e2627 100644
--- a/ext/mbstring/tests/mb_stripos_variation2.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation2.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -19,7 +20,7 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
echo "*** Testing mb_stripos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$haystack = 'string_val';
+$haystack = b'string_val';
$offset = 0;
$encoding = 'utf-8';
@@ -74,8 +75,8 @@ $inputs = array(
'',
// string data
-/*18*/ "string",
- 'string',
+/*18*/ b"string",
+ b'string',
$heredoc,
// object data
@@ -193,6 +194,7 @@ bool(false)
-- Iteration 24 --
-Warning: mb_stripos() expects parameter 2 to be string, resource given in %s on line %d
+Warning: mb_stripos() expects parameter 2 to be binary string, resource given in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_stripos_variation3.phpt b/ext/mbstring/tests/mb_stripos_variation3.phpt
index 0aada9ee70..e2d2a4ca04 100644
--- a/ext/mbstring/tests/mb_stripos_variation3.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation3.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -19,8 +20,8 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
echo "*** Testing mb_stripos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$needle = 'a';
-$haystack = 'string_val';
+$needle = b'A';
+$haystack = b'string_val';
$encoding = 'utf-8';
//get an unset variable
@@ -161,27 +162,27 @@ int(8)
-- Iteration 16 --
-Warning: mb_stripos() expects parameter 3 to be long, string given in %s on line %d
+Warning: mb_stripos() expects parameter 3 to be long, Unicode string given in %s on line %d
bool(false)
-- Iteration 17 --
-Warning: mb_stripos() expects parameter 3 to be long, string given in %s on line %d
+Warning: mb_stripos() expects parameter 3 to be long, Unicode string given in %s on line %d
bool(false)
-- Iteration 18 --
-Warning: mb_stripos() expects parameter 3 to be long, string given in %s on line %d
+Warning: mb_stripos() expects parameter 3 to be long, Unicode string given in %s on line %d
bool(false)
-- Iteration 19 --
-Warning: mb_stripos() expects parameter 3 to be long, string given in %s on line %d
+Warning: mb_stripos() expects parameter 3 to be long, Unicode string given in %s on line %d
bool(false)
-- Iteration 20 --
-Warning: mb_stripos() expects parameter 3 to be long, string given in %s on line %d
+Warning: mb_stripos() expects parameter 3 to be long, Unicode string given in %s on line %d
bool(false)
-- Iteration 21 --
@@ -200,3 +201,4 @@ int(8)
Warning: mb_stripos() expects parameter 3 to be long, resource given in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_stripos_variation4.phpt b/ext/mbstring/tests/mb_stripos_variation4.phpt
index c62b2c3ff5..cef282a555 100644
--- a/ext/mbstring/tests/mb_stripos_variation4.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation4.phpt
@@ -7,9 +7,10 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
?>
--FILE--
<?php
-/* Prototype : int mb_stripos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of first occurrence of a string within another
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
* Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
*/
/*
@@ -20,8 +21,8 @@ function_exists('mb_stripos') or die("skip mb_stripos() is not available in this
echo "*** Testing mb_stripos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$haystack = 'string_val';
-$needle = 'val';
+$haystack = b'string_val';
+$needle = b'VaL';
$offset = 0;
//get an unset variable
@@ -110,86 +111,132 @@ echo "Done";
-- Iteration 1 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "0" in %s on line %d
bool(false)
-- Iteration 2 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "1" in %s on line %d
bool(false)
-- Iteration 3 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "12345" in %s on line %d
bool(false)
-- Iteration 4 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "-2345" in %s on line %d
bool(false)
-- Iteration 5 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "10.5" in %s on line %d
bool(false)
-- Iteration 6 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "-10.5" in %s on line %d
bool(false)
-- Iteration 7 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "123456789000" in %s on line %d
bool(false)
-- Iteration 8 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "1.23456789E-9" in %s on line %d
bool(false)
-- Iteration 9 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "0.5" in %s on line %d
bool(false)
-- Iteration 10 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 11 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 12 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "1" in %s on line %d
bool(false)
-- Iteration 13 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 14 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "1" in %s on line %d
bool(false)
-- Iteration 15 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 16 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 17 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
@@ -207,16 +254,25 @@ int(7)
-- Iteration 22 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 23 --
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_stripos(): Illegal character encoding specified in %s on line %d
+
Warning: mb_stripos(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 24 --
-Warning: mb_stripos() expects parameter 4 to be string, resource given in %s on line %d
+Warning: mb_stripos() expects parameter 4 to be binary string, resource given in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
new file mode 100644
index 0000000000..0a5e682e02
--- /dev/null
+++ b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Test mb_stripos() function : usage variations - Pass different integers as $offset argument
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stripos') or die("skip mb_stripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test how mb_stripos() behaves when passed different integers as $offset argument
+ * The character length of $string_ascii and $string_mb is the same,
+ * and the needle appears at the same positions in both strings
+ */
+
+mb_internal_encoding('UTF-8');
+
+echo "*** Testing mb_stripos() : usage variations ***\n";
+
+$string_ascii = b'+Is an English string'; //21 chars
+$needle_ascii = b'G';
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
+$needle_mb = base64_decode('44CC');
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * mb_stripos should not be able to accept negative values as $offset.
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -10; $i <= 60; $i += 10) {
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ var_dump(mb_stripos($string_ascii, $needle_ascii, $i));
+ echo "--Multibyte String --\n";
+ var_dump(mb_stripos($string_mb, $needle_mb, $i, 'UTF-8'));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_stripos() : usage variations ***
+
+**-- Offset is: -10 --**
+-- ASCII String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+--Multibyte String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+**-- Offset is: 0 --**
+-- ASCII String --
+int(9)
+--Multibyte String --
+int(9)
+
+**-- Offset is: 10 --**
+-- ASCII String --
+int(20)
+--Multibyte String --
+int(20)
+
+**-- Offset is: 20 --**
+-- ASCII String --
+int(20)
+--Multibyte String --
+int(20)
+
+**-- Offset is: 30 --**
+-- ASCII String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 40 --**
+-- ASCII String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 50 --**
+-- ASCII String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 60 --**
+-- ASCII String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+--Multibyte String --
+
+Warning: mb_stripos(): Offset not contained in string. in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_stristr_error1.phpt b/ext/mbstring/tests/mb_stristr_error1.phpt
new file mode 100644
index 0000000000..3c766c4fad
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_stristr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : error conditions ***\n";
+
+
+//Test mb_stristr with one more than the expected number of arguments
+echo "\n-- Testing mb_stristr() function with more than expected no. of arguments --\n";
+$haystack = b'string_val';
+$needle = b'string_val';
+$part = true;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_stristr($haystack, $needle, $part, $encoding, $extra_arg) );
+
+// Testing mb_stristr with one less than the expected number of arguments
+echo "\n-- Testing mb_stristr() function with less than expected no. of arguments --\n";
+$haystack = b'string_val';
+var_dump( mb_stristr($haystack) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : error conditions ***
+
+-- Testing mb_stristr() function with more than expected no. of arguments --
+
+Warning: mb_stristr() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_stristr() function with less than expected no. of arguments --
+
+Warning: mb_stristr() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_error2.phpt b/ext/mbstring/tests/mb_stristr_error2.phpt
new file mode 100644
index 0000000000..73f13dc856
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_stristr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : error conditions ***\n";
+
+
+echo "\n-- Testing mb_stristr() with unknown encoding --\n";
+$haystack = b'Hello, world';
+$needle = b'world';
+$encoding = 'unknown-encoding';
+$part = true;
+var_dump( mb_stristr($haystack, $needle, $part, $encoding) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : error conditions ***
+
+-- Testing mb_stristr() with unknown encoding --
+
+Warning: mb_stristr(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_variation1.phpt b/ext/mbstring/tests/mb_stristr_variation1.phpt
new file mode 100644
index 0000000000..d44275ce2d
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test mb_stristr() function : usage variation - various haystacks, needle won't be found
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$needle = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for haystack
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_stristr($value, $needle, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : usage variation ***
+
+--int 0--
+string(0) ""
+
+--int 1--
+string(0) ""
+
+--int 12345--
+string(0) ""
+
+--int -12345--
+string(0) ""
+
+--float 10.5--
+string(0) ""
+
+--float -10.5--
+string(0) ""
+
+--float 12.3456789000e10--
+string(0) ""
+
+--float -12.3456789000e10--
+string(0) ""
+
+--float .5--
+string(0) ""
+
+--empty array--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+string(0) ""
+
+--lowercase null--
+string(0) ""
+
+--lowercase true--
+string(0) ""
+
+--lowercase false--
+string(0) ""
+
+--uppercase TRUE--
+string(0) ""
+
+--uppercase FALSE--
+string(0) ""
+
+--empty string DQ--
+string(0) ""
+
+--empty string SQ--
+string(0) ""
+
+--instance of classWithToString--
+string(0) ""
+
+--instance of classWithoutToString--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+string(0) ""
+
+--unset var--
+string(0) ""
+
+--resource--
+Error: 2 - mb_stristr() expects parameter 1 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_stristr_variation2.phpt b/ext/mbstring/tests/mb_stristr_variation2.phpt
new file mode 100644
index 0000000000..921d98e305
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_variation2.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test mb_stristr() function : usage variation - different types of needle.
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for needle
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_stristr($haystack, $value, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : usage variation ***
+
+--int 0--
+string(0) ""
+
+--int 1--
+string(0) ""
+
+--int 12345--
+string(0) ""
+
+--int -12345--
+string(0) ""
+
+--float 10.5--
+string(0) ""
+
+--float -10.5--
+string(0) ""
+
+--float 12.3456789000e10--
+string(0) ""
+
+--float -12.3456789000e10--
+string(0) ""
+
+--float .5--
+string(0) ""
+
+--empty array--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--lowercase true--
+string(0) ""
+
+--lowercase false--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--uppercase TRUE--
+string(0) ""
+
+--uppercase FALSE--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 4096 - Method classWithToString::__toString() must return a string value, %s(%d)
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_stristr(): Empty delimiter., %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_stristr() expects parameter 2 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_stristr_variation3.phpt b/ext/mbstring/tests/mb_stristr_variation3.phpt
new file mode 100644
index 0000000000..bd4551b0c0
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test mb_stristr() function : usage variation - different values for part
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for part
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mb_stristr($haystack, $needle, $value, $encoding);
+ if ($res === false) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : usage variation ***
+
+--int 0--
+unicode(8) "5f76616c"
+
+--int 1--
+unicode(12) "737472696e67"
+
+--int 12345--
+unicode(12) "737472696e67"
+
+--int -12345--
+unicode(12) "737472696e67"
+
+--float 10.5--
+unicode(12) "737472696e67"
+
+--float -10.5--
+unicode(12) "737472696e67"
+
+--float 12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float -12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float .5--
+unicode(12) "737472696e67"
+
+--empty array--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+unicode(8) "5f76616c"
+
+--lowercase null--
+unicode(8) "5f76616c"
+
+--lowercase true--
+unicode(12) "737472696e67"
+
+--lowercase false--
+unicode(8) "5f76616c"
+
+--uppercase TRUE--
+unicode(12) "737472696e67"
+
+--uppercase FALSE--
+unicode(8) "5f76616c"
+
+--empty string DQ--
+unicode(8) "5f76616c"
+
+--empty string SQ--
+unicode(8) "5f76616c"
+
+--string DQ--
+unicode(12) "737472696e67"
+
+--string SQ--
+unicode(12) "737472696e67"
+
+--mixed case string--
+unicode(12) "737472696e67"
+
+--heredoc--
+unicode(12) "737472696e67"
+
+--instance of classWithToString--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+unicode(8) "5f76616c"
+
+--unset var--
+unicode(8) "5f76616c"
+
+--resource--
+Error: 2 - mb_stristr() expects parameter 3 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_variation4.phpt b/ext/mbstring/tests/mb_stristr_variation4.phpt
new file mode 100644
index 0000000000..3787ab8b68
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_variation4.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test mb_stristr() function : usage variation - different encoding types
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$part = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "invalid";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+utf-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for encoding
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_stristr($haystack, $needle, $part, $value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_stristr() : usage variation ***
+
+--int 0--
+Error: 2 - mb_stristr(): Unknown encoding "0", %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - mb_stristr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - mb_stristr(): Unknown encoding "12345", %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - mb_stristr(): Unknown encoding "-2345", %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - mb_stristr(): Unknown encoding "10.5", %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - mb_stristr(): Unknown encoding "-10.5", %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - mb_stristr(): Unknown encoding "123456789000", %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - mb_stristr(): Unknown encoding "-123456789000", %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - mb_stristr(): Unknown encoding "0.5", %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - mb_stristr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - mb_stristr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - mb_stristr(): Unknown encoding "invalid", %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_stristr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_stristr() expects parameter 4 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_variation5.phpt b/ext/mbstring/tests/mb_stristr_variation5.phpt
new file mode 100644
index 0000000000..a78902f7e6
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_variation5.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test mb_stristr() function : usage variation - multiple needles
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_stristr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_stristr() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii mixed case, multiple needles
+$string_ascii = b'abcDef zBcDyx';
+$needle_ascii_upper = b"BCD";
+$needle_ascii_mixed = b"bCd";
+$needle_ascii_lower = b"bcd";
+
+//Greek string in mixed case UTF-8 with multiple needles
+$string_mb = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA==');
+$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
+$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
+$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
+
+echo "\n-- ASCII string: needle exists --\n";
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_upper, false)));
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_upper, true)));
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_lower, false)));
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_lower, true)));
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_mixed, false)));
+var_dump(bin2hex(mb_stristr($string_ascii, $needle_ascii_mixed, true)));
+
+
+echo "\n-- Multibyte string: needle exists --\n";
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_upper, false)));
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_upper, true)));
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_lower, false)));
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_lower, true)));
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, false)));
+var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, true)));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_stristr() : basic functionality ***
+
+-- ASCII string: needle exists --
+unicode(24) "6263446566207a4263447978"
+unicode(2) "61"
+unicode(24) "6263446566207a4263447978"
+unicode(2) "61"
+unicode(24) "6263446566207a4263447978"
+unicode(2) "61"
+
+-- Multibyte string: needle exists --
+unicode(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
+unicode(8) "cebacebb"
+unicode(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
+unicode(8) "cebacebb"
+unicode(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
+unicode(8) "cebacebb"
+===DONE===
diff --git a/ext/mbstring/tests/mb_strlen_basic.phpt b/ext/mbstring/tests/mb_strlen_basic.phpt
index 0e62b881b4..a5dbe512b3 100644
--- a/ext/mbstring/tests/mb_strlen_basic.phpt
+++ b/ext/mbstring/tests/mb_strlen_basic.phpt
@@ -18,7 +18,7 @@ function_exists('mb_strlen') or die("skip mb_strlen() is not available in this b
echo "*** Testing mb_strlen() : basic functionality***\n";
-$string_ascii = 'abc def';
+$string_ascii = b'abc def';
//Japanese string in UTF-8
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
@@ -31,7 +31,7 @@ var_dump(mb_strlen($string_mb, 'UTF-8'));
echo "\nDone";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_strlen() : basic functionality***
-- ASCII String --
diff --git a/ext/mbstring/tests/mb_strlen_variation1.phpt b/ext/mbstring/tests/mb_strlen_variation1.phpt
index 6e518a3172..c69a0aca2b 100644
--- a/ext/mbstring/tests/mb_strlen_variation1.phpt
+++ b/ext/mbstring/tests/mb_strlen_variation1.phpt
@@ -34,7 +34,7 @@ class classA
}
// heredoc string
-$heredoc = <<<EOT
+$heredoc = b<<<EOT
hello world
EOT;
@@ -72,8 +72,8 @@ $inputs = array(
'',
// string data
-/*18*/ "string",
- 'string',
+/*18*/ b"string",
+ b'string',
$heredoc,
// object data
@@ -177,4 +177,4 @@ int(0)
Warning: mb_strlen() expects parameter 1 to be binary string, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_basic.phpt b/ext/mbstring/tests/mb_strpos_basic.phpt
index ade1598501..36641b127b 100644
--- a/ext/mbstring/tests/mb_strpos_basic.phpt
+++ b/ext/mbstring/tests/mb_strpos_basic.phpt
@@ -20,12 +20,12 @@ echo "*** Testing mb_strpos() : basic functionality***\n";
mb_internal_encoding('UTF-8');
-$string_ascii = 'abc def';
+$string_ascii = b'abc def';
//Japanese string in UTF-8
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
echo "\n-- ASCII string 1 --\n";
-var_dump(mb_strpos($string_ascii, 'd', 2, 'ISO-8859-1'));
+var_dump(mb_strpos($string_ascii, b'd', 2, 'ISO-8859-1'));
echo "\n-- ASCII string 2 --\n";
var_dump(mb_strpos($string_ascii, '123'));
@@ -54,4 +54,4 @@ int(0)
-- Multibyte string 2 --
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation2.phpt b/ext/mbstring/tests/mb_strpos_variation2.phpt
index 93fb90cd59..dcd70a3c2b 100644
--- a/ext/mbstring/tests/mb_strpos_variation2.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation2.phpt
@@ -19,7 +19,7 @@ function_exists('mb_strpos') or die("skip mb_strpos() is not available in this b
echo "*** Testing mb_strpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$haystack = 'string_val';
+$haystack = b'string_val';
$offset = 0;
$encoding = 'utf-8';
@@ -36,7 +36,7 @@ class classA
}
// heredoc string
-$heredoc = <<<EOT
+$heredoc = b<<<EOT
hello world
EOT;
@@ -74,8 +74,8 @@ $inputs = array(
'',
// string data
-/*18*/ "string",
- 'string',
+/*18*/ b"string",
+ b'string',
$heredoc,
// object data
@@ -195,4 +195,4 @@ bool(false)
Warning: mb_strpos() expects parameter 2 to be binary string, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation3.phpt b/ext/mbstring/tests/mb_strpos_variation3.phpt
index b88e63d5e1..69cf641d84 100644
--- a/ext/mbstring/tests/mb_strpos_variation3.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation3.phpt
@@ -19,8 +19,8 @@ function_exists('mb_strpos') or die("skip mb_strpos() is not available in this b
echo "*** Testing mb_strpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$needle = 'a';
-$haystack = 'string_val';
+$needle = b'a';
+$haystack = b'string_val';
$encoding = 'utf-8';
//get an unset variable
@@ -200,3 +200,4 @@ int(8)
Warning: mb_strpos() expects parameter 3 to be long, resource given in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_strpos_variation4.phpt b/ext/mbstring/tests/mb_strpos_variation4.phpt
index b3dde0ccc5..e0864bcfd8 100644
--- a/ext/mbstring/tests/mb_strpos_variation4.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation4.phpt
@@ -20,8 +20,8 @@ function_exists('mb_strpos') or die("skip mb_strpos() is not available in this b
echo "*** Testing mb_strpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$haystack = 'string_val';
-$needle = 'val';
+$haystack = b'string_val';
+$needle = b'val';
$offset = 0;
//get an unset variable
@@ -219,4 +219,4 @@ bool(false)
Warning: mb_strpos() expects parameter 4 to be binary string, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation5.phpt b/ext/mbstring/tests/mb_strpos_variation5.phpt
index 594b2363b5..0164f0faf5 100644
--- a/ext/mbstring/tests/mb_strpos_variation5.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation5.phpt
@@ -22,8 +22,8 @@ mb_internal_encoding('UTF-8');
echo "*** Testing mb_strpos() : usage variations ***\n";
-$string_ascii = '+Is an English string'; //21 chars
-$needle_ascii = 'g';
+$string_ascii = b'+Is an English string'; //21 chars
+$needle_ascii = b'g';
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
$needle_mb = base64_decode('44CC');
@@ -81,8 +81,6 @@ int(20)
Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
**-- Offset is: 40 --**
@@ -91,8 +89,6 @@ bool(false)
Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
**-- Offset is: 50 --**
@@ -101,8 +97,6 @@ bool(false)
Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
**-- Offset is: 60 --**
@@ -115,3 +109,4 @@ bool(false)
Warning: mb_strpos(): Offset not contained in string. in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_strrchr_basic.phpt b/ext/mbstring/tests/mb_strrchr_basic.phpt
new file mode 100644
index 0000000000..3007446aac
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_basic.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test mb_strrchr() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = b'abc def';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string: needle exists --\n";
+var_dump(bin2hex(mb_strrchr($string_ascii, b'd', false, 'ISO-8859-1')));
+var_dump(bin2hex(mb_strrchr($string_ascii, b'd')));
+var_dump(bin2hex(mb_strrchr($string_ascii, b'd', true)));
+
+
+echo "\n-- ASCII string: needle doesn't exist --\n";
+var_dump(mb_strrchr($string_ascii, b'123'));
+
+echo "\n-- Multibyte string: needle exists --\n";
+$needle1 = base64_decode('5pel5pys6Kqe');
+var_dump(bin2hex(mb_strrchr($string_mb, $needle1)));
+var_dump(bin2hex(mb_strrchr($string_mb, $needle1, false, 'utf-8')));
+var_dump(bin2hex(mb_strrchr($string_mb, $needle1, true)));
+
+
+echo "\n-- Multibyte string: needle doesn't exist --\n";
+$needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
+var_dump(mb_strrchr($string_mb, $needle2));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strrchr() : basic functionality ***
+
+-- ASCII string: needle exists --
+unicode(6) "646566"
+unicode(6) "646566"
+unicode(8) "61626320"
+
+-- ASCII string: needle doesn't exist --
+bool(false)
+
+-- Multibyte string: needle exists --
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(0) ""
+
+-- Multibyte string: needle doesn't exist --
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrchr_error1.phpt b/ext/mbstring/tests/mb_strrchr_error1.phpt
new file mode 100644
index 0000000000..5ebb3d06f6
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_strrchr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : error conditions ***\n";
+
+
+//Test mb_strrchr with one more than the expected number of arguments
+echo "\n-- Testing mb_strrchr() function with more than expected no. of arguments --\n";
+$haystack = b'string_val';
+$needle = b'string_val';
+$part = true;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strrchr($haystack, $needle, $part, $encoding, $extra_arg) );
+
+// Testing mb_strrchr with one less than the expected number of arguments
+echo "\n-- Testing mb_strrchr() function with less than expected no. of arguments --\n";
+$haystack = b'string_val';
+var_dump( mb_strrchr($haystack) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : error conditions ***
+
+-- Testing mb_strrchr() function with more than expected no. of arguments --
+
+Warning: mb_strrchr() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strrchr() function with less than expected no. of arguments --
+
+Warning: mb_strrchr() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_error2.phpt b/ext/mbstring/tests/mb_strrchr_error2.phpt
new file mode 100644
index 0000000000..cfbcd66a09
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_strrchr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : error conditions ***\n";
+
+
+echo "\n-- Testing mb_strrchr() with unknown encoding --\n";
+$haystack = b'Hello, world';
+$needle = b'world';
+$encoding = 'unknown-encoding';
+$part = true;
+var_dump( mb_strrchr($haystack, $needle, $part, $encoding) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : error conditions ***
+
+-- Testing mb_strrchr() with unknown encoding --
+
+Warning: mb_strrchr(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation1.phpt b/ext/mbstring/tests/mb_strrchr_variation1.phpt
new file mode 100644
index 0000000000..23cb454ad8
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation1.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test mb_strrchr() function : usage variation - various haystacks, needle won't be found
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$needle = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for haystack
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrchr($value, $needle, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - mb_strrchr() expects parameter 1 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation2.phpt b/ext/mbstring/tests/mb_strrchr_variation2.phpt
new file mode 100644
index 0000000000..666345f891
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation2.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test mb_strrchr() function : usage variation - different types of needle.
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for needle
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrchr($haystack, $value, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - mb_strrchr() expects parameter 2 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation3.phpt b/ext/mbstring/tests/mb_strrchr_variation3.phpt
new file mode 100644
index 0000000000..812d453097
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test mb_strrchr() function : usage variation - different values for part
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for part
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mb_strrchr($haystack, $needle, $value, $encoding);
+ if ($res === false) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : usage variation ***
+
+--int 0--
+unicode(8) "5f76616c"
+
+--int 1--
+unicode(12) "737472696e67"
+
+--int 12345--
+unicode(12) "737472696e67"
+
+--int -12345--
+unicode(12) "737472696e67"
+
+--float 10.5--
+unicode(12) "737472696e67"
+
+--float -10.5--
+unicode(12) "737472696e67"
+
+--float 12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float -12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float .5--
+unicode(12) "737472696e67"
+
+--empty array--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+unicode(8) "5f76616c"
+
+--lowercase null--
+unicode(8) "5f76616c"
+
+--lowercase true--
+unicode(12) "737472696e67"
+
+--lowercase false--
+unicode(8) "5f76616c"
+
+--uppercase TRUE--
+unicode(12) "737472696e67"
+
+--uppercase FALSE--
+unicode(8) "5f76616c"
+
+--empty string DQ--
+unicode(8) "5f76616c"
+
+--empty string SQ--
+unicode(8) "5f76616c"
+
+--string DQ--
+unicode(12) "737472696e67"
+
+--string SQ--
+unicode(12) "737472696e67"
+
+--mixed case string--
+unicode(12) "737472696e67"
+
+--heredoc--
+unicode(12) "737472696e67"
+
+--instance of classWithToString--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+unicode(8) "5f76616c"
+
+--unset var--
+unicode(8) "5f76616c"
+
+--resource--
+Error: 2 - mb_strrchr() expects parameter 3 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation4.phpt b/ext/mbstring/tests/mb_strrchr_variation4.phpt
new file mode 100644
index 0000000000..8e16d5b910
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation4.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test mb_strrchr() function : usage variation - different encoding types
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$part = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "invalid";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+invalid
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for encoding
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrchr($haystack, $needle, $part, $value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrchr() : usage variation ***
+
+--int 0--
+Error: 2 - mb_strrchr(): Unknown encoding "0", %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - mb_strrchr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - mb_strrchr(): Unknown encoding "12345", %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - mb_strrchr(): Unknown encoding "-2345", %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - mb_strrchr(): Unknown encoding "10.5", %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - mb_strrchr(): Unknown encoding "-10.5", %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - mb_strrchr(): Unknown encoding "123456789000", %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - mb_strrchr(): Unknown encoding "-123456789000", %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - mb_strrchr(): Unknown encoding "0.5", %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - mb_strrchr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - mb_strrchr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - mb_strrchr(): Unknown encoding "invalid", %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_strrchr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_strrchr() expects parameter 4 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation5.phpt b/ext/mbstring/tests/mb_strrchr_variation5.phpt
new file mode 100644
index 0000000000..0d3fbfc150
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation5.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test mb_strrchr() function : variation - multiple needles
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : variation ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//with repeated needles
+$string_ascii = b'abcdef zbcdyx';
+$needle_ascii = b"bcd";
+
+//Japanese string in UTF-8 with repeated needles
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OIMzTvvJXvvJbml6XmnKzoqp7jg4bjgq3jgrnjg4g=');
+$needle_mb = base64_decode('6Kqe44OG44Kt');
+
+echo "-- Ascii data --\n";
+var_dump(bin2hex(mb_strrchr($string_ascii, $needle_ascii, false)));
+var_dump(bin2hex(mb_strrchr($string_ascii, $needle_ascii, true)));
+
+echo "-- mb data in utf-8 --\n";
+$res = mb_strrchr($string_mb, $needle_mb, false);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+$res = mb_strrchr($string_mb, $needle_mb, true);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strrchr() : variation ***
+-- Ascii data --
+unicode(10) "6263647978"
+unicode(16) "616263646566207a"
+-- mb data in utf-8 --
+unicode(30) "e8aa9ee38386e382ade382b9e38388"
+unicode(70) "e697a5e69cace8aa9ee38386e382ade382b9e383883334efbc95efbc96e697a5e69cac"
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation6.phpt b/ext/mbstring/tests/mb_strrchr_variation6.phpt
new file mode 100644
index 0000000000..49b389fe25
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_variation6.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test mb_strrchr() function : variation - case sensitivity
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrchr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrchr() : variation ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii
+$string_ascii = b'abcdef';
+$needle_ascii_upper = b"BCD";
+$needle_ascii_mixed = b"bCd";
+$needle_ascii_lower = b"bcd";
+
+//Greek string in lower case UTF-8
+$string_mb = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
+$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
+$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
+
+echo "-- Ascii data --\n";
+// needle should be found
+var_dump(bin2hex(mb_strrchr($string_ascii, $needle_ascii_lower)));
+// no needle should be found
+var_dump(mb_strrchr($string_ascii, $needle_ascii_upper));
+var_dump(mb_strrchr($string_ascii, $needle_ascii_mixed));
+
+echo "-- mb data in utf-8 --\n";
+// needle should be found
+$res = mb_strrchr($string_mb, $needle_mb_lower, false);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+// no needle should be found
+var_dump(mb_strrchr($string_mb, $needle_mb_upper));
+var_dump(mb_strrchr($string_mb, $needle_mb_mixed));
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strrchr() : variation ***
+-- Ascii data --
+unicode(10) "6263646566"
+bool(false)
+bool(false)
+-- mb data in utf-8 --
+unicode(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrichr_basic.phpt b/ext/mbstring/tests/mb_strrichr_basic.phpt
new file mode 100644
index 0000000000..f46c6a6890
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test mb_strrichr() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = b'abcdef';
+$needle_ascii_upper = b"BCD";
+$needle_ascii_mixed = b"bCd";
+$needle_ascii_lower = b"bcd";
+
+//Greek string in lower case UTF-8
+$string_mb = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
+$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
+$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
+
+echo "\n-- ASCII string: needle exists --\n";
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, false, 'ISO-8859-1')));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, true)));
+
+
+echo "\n-- ASCII string: needle doesn't exist --\n";
+var_dump(mb_strrichr($string_ascii, b'123'));
+
+echo "\n-- Multibyte string: needle exists --\n";
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, false, 'utf-8')));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true)));
+
+
+echo "\n-- Multibyte string: needle doesn't exist --\n";
+$needle2 = base64_decode('zrzOvs6/');
+var_dump(mb_strrichr($string_mb, $needle2));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strrichr() : basic functionality ***
+
+-- ASCII string: needle exists --
+unicode(10) "6263646566"
+unicode(10) "6263646566"
+unicode(2) "61"
+
+-- ASCII string: needle doesn't exist --
+bool(false)
+
+-- Multibyte string: needle exists --
+unicode(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
+unicode(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
+unicode(44) "ceb1ceb2ceb3ceb4ceb5ceb6ceb7ceb8ceb9cebacebb"
+
+-- Multibyte string: needle doesn't exist --
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_error1.phpt b/ext/mbstring/tests/mb_strrichr_error1.phpt
new file mode 100644
index 0000000000..2c2ed61149
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_strrichr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : error conditions ***\n";
+
+
+//Test mb_strrichr with one more than the expected number of arguments
+echo "\n-- Testing mb_strrichr() function with more than expected no. of arguments --\n";
+$haystack = b'string_val';
+$needle = b'string_val';
+$part = true;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strrichr($haystack, $needle, $part, $encoding, $extra_arg) );
+
+// Testing mb_strrichr with one less than the expected number of arguments
+echo "\n-- Testing mb_strrichr() function with less than expected no. of arguments --\n";
+$haystack = b'string_val';
+var_dump( mb_strrichr($haystack) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : error conditions ***
+
+-- Testing mb_strrichr() function with more than expected no. of arguments --
+
+Warning: mb_strrichr() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strrichr() function with less than expected no. of arguments --
+
+Warning: mb_strrichr() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_error2.phpt b/ext/mbstring/tests/mb_strrichr_error2.phpt
new file mode 100644
index 0000000000..e8f98ef442
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_strrichr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : error conditions ***\n";
+
+
+echo "\n-- Testing mb_strrichr() with unknown encoding --\n";
+$haystack = b'Hello, world';
+$needle = b'world';
+$encoding = 'unknown-encoding';
+$part = true;
+var_dump( mb_strrichr($haystack, $needle, $part, $encoding) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : error conditions ***
+
+-- Testing mb_strrichr() with unknown encoding --
+
+Warning: mb_strrichr(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation1.phpt b/ext/mbstring/tests/mb_strrichr_variation1.phpt
new file mode 100644
index 0000000000..748b66adc2
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_variation1.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test mb_strrichr() function : usage variation - various haystacks, needle won't be found
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$needle = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for haystack
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrichr($value, $needle, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - mb_strrichr() expects parameter 1 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation2.phpt b/ext/mbstring/tests/mb_strrichr_variation2.phpt
new file mode 100644
index 0000000000..f529b24385
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_variation2.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test mb_strrichr() function : usage variation - different types of needle.
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for needle
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrichr($haystack, $value, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - mb_strrichr() expects parameter 2 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation3.phpt b/ext/mbstring/tests/mb_strrichr_variation3.phpt
new file mode 100644
index 0000000000..e7a463fdfc
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test mb_strrichr() function : usage variation - different values for part
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for part
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mb_strrichr($haystack, $needle, $value, $encoding);
+ if ($res === false) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : usage variation ***
+
+--int 0--
+unicode(8) "5f76616c"
+
+--int 1--
+unicode(12) "737472696e67"
+
+--int 12345--
+unicode(12) "737472696e67"
+
+--int -12345--
+unicode(12) "737472696e67"
+
+--float 10.5--
+unicode(12) "737472696e67"
+
+--float -10.5--
+unicode(12) "737472696e67"
+
+--float 12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float -12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float .5--
+unicode(12) "737472696e67"
+
+--empty array--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+unicode(8) "5f76616c"
+
+--lowercase null--
+unicode(8) "5f76616c"
+
+--lowercase true--
+unicode(12) "737472696e67"
+
+--lowercase false--
+unicode(8) "5f76616c"
+
+--uppercase TRUE--
+unicode(12) "737472696e67"
+
+--uppercase FALSE--
+unicode(8) "5f76616c"
+
+--empty string DQ--
+unicode(8) "5f76616c"
+
+--empty string SQ--
+unicode(8) "5f76616c"
+
+--string DQ--
+unicode(12) "737472696e67"
+
+--string SQ--
+unicode(12) "737472696e67"
+
+--mixed case string--
+unicode(12) "737472696e67"
+
+--heredoc--
+unicode(12) "737472696e67"
+
+--instance of classWithToString--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+unicode(8) "5f76616c"
+
+--unset var--
+unicode(8) "5f76616c"
+
+--resource--
+Error: 2 - mb_strrichr() expects parameter 3 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation4.phpt b/ext/mbstring/tests/mb_strrichr_variation4.phpt
new file mode 100644
index 0000000000..c933bdcc40
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_variation4.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test mb_strrichr() function : usage variation - different encoding types
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$part = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "invalid";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+invalid
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for encoding
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strrichr($haystack, $needle, $part, $value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strrichr() : usage variation ***
+
+--int 0--
+Error: 2 - mb_strrichr(): Unknown encoding "0", %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - mb_strrichr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - mb_strrichr(): Unknown encoding "12345", %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - mb_strrichr(): Unknown encoding "-2345", %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - mb_strrichr(): Unknown encoding "10.5", %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - mb_strrichr(): Unknown encoding "-10.5", %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - mb_strrichr(): Unknown encoding "123456789000", %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - mb_strrichr(): Unknown encoding "-123456789000", %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - mb_strrichr(): Unknown encoding "0.5", %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - mb_strrichr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - mb_strrichr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - mb_strrichr(): Unknown encoding "invalid", %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_strrichr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_strrichr() expects parameter 4 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation5.phpt b/ext/mbstring/tests/mb_strrichr_variation5.phpt
new file mode 100644
index 0000000000..39a7970f07
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrichr_variation5.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test mb_strrichr() function : usage variation - multiple needles
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strrichr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds the last occurrence of a character in a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strrichr() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii mixed case, multiple needles
+$string_ascii = b'abcDef zBcDyx';
+$needle_ascii_upper = b"BCD";
+$needle_ascii_mixed = b"bCd";
+$needle_ascii_lower = b"bcd";
+
+//Greek string in mixed case UTF-8 with multiple needles
+$string_mb = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA==');
+$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
+$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
+$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
+
+echo "\n-- ASCII string: needle exists --\n";
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, false)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_upper, true)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, false)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_lower, true)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, false)));
+var_dump(bin2hex(mb_strrichr($string_ascii, $needle_ascii_mixed, true)));
+
+
+echo "\n-- Multibyte string: needle exists --\n";
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, false)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_upper, true)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, false)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_lower, true)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, false)));
+var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true)));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strrichr() : basic functionality ***
+
+-- ASCII string: needle exists --
+unicode(10) "4263447978"
+unicode(16) "616263446566207a"
+unicode(10) "4263447978"
+unicode(16) "616263446566207a"
+unicode(10) "4263447978"
+unicode(16) "616263446566207a"
+
+-- Multibyte string: needle exists --
+unicode(20) "ce9cce9dcebecebfcea0"
+unicode(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
+unicode(20) "ce9cce9dcebecebfcea0"
+unicode(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
+unicode(20) "ce9cce9dcebecebfcea0"
+unicode(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
+===DONE=== \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strripos_basic.phpt b/ext/mbstring/tests/mb_strripos_basic.phpt
new file mode 100644
index 0000000000..32787a6eb9
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_basic.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test mb_strripos() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality of mb_strripos with ASCII and multibyte characters
+ */
+
+echo "*** Testing mb_strripos() : basic functionality***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii strings
+$ascii_haystacks = array(
+ b'abc defabc def',
+ b'ABC DEFABC DEF',
+ b'Abc dEFaBC Def',
+);
+
+$ascii_needles = array(
+ // 4 good ones
+ b'DE',
+ b'de',
+ b'De',
+ b'dE',
+
+ //flag a swap between good and bad
+ '!',
+
+ // 4 bad ones
+ b'df',
+ b'Df',
+ b'dF',
+ b'DF'
+);
+
+//greek strings in UTF-8
+$greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
+$greek_mixed = base64_decode('zrHOss6TzpTOlc6WzpfOmM65zrrOu868zr3Ovs6fzqDOoc6jzqTOpc+Gz4fPiM+J');
+$greek_haystacks = array($greek_lower, $greek_upper, $greek_mixed);
+
+$greek_nlower = base64_decode('zrzOvc6+zr8=');
+$greek_nupper = base64_decode('zpzOnc6ezp8=');
+$greek_nmixed1 = base64_decode('zpzOnc6+zr8=');
+$greek_nmixed2 = base64_decode('zrzOvc6+zp8=');
+
+$greek_blower = base64_decode('zpzOns6f');
+$greek_bupper = base64_decode('zrzOvs6/');
+$greek_bmixed1 = base64_decode('zpzOvs6/');
+$greek_bmixed2 = base64_decode('zrzOvs6f');
+$greek_needles = array(
+ // 4 good ones
+ $greek_nlower, $greek_nupper, $greek_nmixed1, $greek_nmixed2,
+
+ '!', // used to flag a swap between good and bad
+
+ // 4 bad ones
+ $greek_blower, $greek_bupper, $greek_bmixed1, $greek_bmixed2,
+);
+
+// try the basic options
+echo "\n -- ASCII Strings, needle should be found --\n";
+foreach ($ascii_needles as $needle) {
+ if ($needle == '!') {
+ echo "\n -- ASCII Strings, needle should not be found --\n";
+ }
+ else {
+ foreach ($ascii_haystacks as $haystack) {
+ var_dump(mb_strripos($haystack, $needle));
+ }
+ }
+}
+
+echo "\n -- Greek Strings, needle should be found --\n";
+foreach ($greek_needles as $needle) {
+ if ($needle == '!') {
+ echo "\n -- ASCII Strings, needle should not be found --\n";
+ }
+ else {
+ foreach ($greek_haystacks as $haystack) {
+ var_dump(mb_strripos($haystack, $needle));
+ }
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : basic functionality***
+
+ -- ASCII Strings, needle should be found --
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+
+ -- ASCII Strings, needle should not be found --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+ -- Greek Strings, needle should be found --
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+ -- ASCII Strings, needle should not be found --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strripos_basic2.phpt b/ext/mbstring/tests/mb_strripos_basic2.phpt
new file mode 100644
index 0000000000..9d7befc931
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_basic2.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test mb_strripos() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality of mb_strripos with ASCII and multibyte characters
+ */
+
+echo "*** Testing mb_strripos() : basic functionality***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii strings
+$ascii_haystacks = array(
+ b'abc defabc def',
+ b'ABC DEFABC DEF',
+ b'Abc dEFaBC Def',
+);
+
+$ascii_needles = array(
+ // 4 good ones
+ b'DE',
+ b'de',
+ b'De',
+ b'dE',
+);
+
+//greek strings in UTF-8
+$greek_lower = base64_decode('zrrOu868zr3Ovs6/z4DPgSDOus67zrzOvc6+zr/PgA==');
+$greek_upper = base64_decode('zprOm86czp3Ons6fzqDOoSDOms6bzpzOnc6ezp/OoA==');
+$greek_mixed = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA==');
+$greek_haystacks = array($greek_lower, $greek_upper, $greek_mixed);
+
+$greek_nlower = base64_decode('zrzOvc6+zr8=');
+$greek_nupper = base64_decode('zpzOnc6ezp8=');
+$greek_nmixed1 = base64_decode('zpzOnc6+zr8=');
+$greek_nmixed2 = base64_decode('zrzOvc6+zp8=');
+
+$greek_needles = array(
+ // 4 good ones
+ $greek_nlower, $greek_nupper, $greek_nmixed1, $greek_nmixed2,
+);
+
+// try the basic options
+echo "\n -- ASCII Strings --\n";
+foreach ($ascii_needles as $needle) {
+ foreach ($ascii_haystacks as $haystack) {
+ var_dump(mb_strripos($haystack, $needle));
+ var_dump(mb_strripos($haystack, $needle, 14));
+ }
+}
+
+echo "\n -- Greek Strings --\n";
+foreach ($greek_needles as $needle) {
+ foreach ($greek_haystacks as $haystack) {
+ var_dump(mb_strripos($haystack, $needle));
+ var_dump(mb_strripos($haystack, $needle, 12));
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : basic functionality***
+
+ -- ASCII Strings --
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+int(13)
+bool(false)
+
+ -- Greek Strings --
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+int(11)
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strripos_error1.phpt b/ext/mbstring/tests/mb_strripos_error1.phpt
new file mode 100644
index 0000000000..9d114d55a4
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_error1.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test mb_strripos() function : error conditions - Pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test how mb_strripos behaves when passed an incorrect number of arguments
+ */
+
+echo "*** Testing mb_strripos() : error conditions ***\n";
+
+
+//Test mb_strripos with one more than the expected number of arguments
+echo "\n-- Testing mb_strripos() function with more than expected no. of arguments --\n";
+$haystack = b'string_val';
+$needle = b'string_val';
+$offset = 10;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strripos($haystack, $needle, $offset, $encoding, $extra_arg) );
+
+// Testing mb_strripos with one less than the expected number of arguments
+echo "\n-- Testing mb_strripos() function with less than expected no. of arguments --\n";
+$haystack = b'string_val';
+var_dump( mb_strripos($haystack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : error conditions ***
+
+-- Testing mb_strripos() function with more than expected no. of arguments --
+
+Warning: mb_strripos() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strripos() function with less than expected no. of arguments --
+
+Warning: mb_strripos() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strripos_error2.phpt b/ext/mbstring/tests/mb_strripos_error2.phpt
new file mode 100644
index 0000000000..65138c4051
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_error2.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test mb_strripos() function : error conditions - Pass unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass an unknown encoding to mb_strripos() to test behaviour
+ */
+
+echo "*** Testing mb_strripos() : error conditions ***\n";
+$haystack = b'Hello, world';
+$needle = b'world';
+$offset = 2;
+$encoding = 'unknown-encoding';
+
+var_dump( mb_strripos($haystack, $needle, $offset, $encoding) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : error conditions ***
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_strripos_variation1.phpt b/ext/mbstring/tests/mb_strripos_variation1.phpt
new file mode 100644
index 0000000000..1395ad3318
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_variation1.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_strripos() function : usage variations - pass different data types to $haystack arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass mb_strripos different data types as $haystack arg to test behaviour
+ */
+
+echo "*** Testing mb_strripos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = b'string_val';
+$offset = 0;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $haystack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strripos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strripos($input, $needle, $offset, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strripos() expects parameter 1 to be binary string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strripos_variation2.phpt b/ext/mbstring/tests/mb_strripos_variation2.phpt
new file mode 100644
index 0000000000..8f90f55b93
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_variation2.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_strripos() function : usage variations - pass different data types as $needle arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass mb_strripos different data types as $needle arg to test behaviour
+ */
+
+echo "*** Testing mb_strripos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = b'string_val';
+$offset = 0;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $needle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ b"string",
+ b'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strripos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strripos($haystack, $input, $offset, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strripos() expects parameter 2 to be binary string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strripos_variation3_Bug45923.phpt b/ext/mbstring/tests/mb_strripos_variation3_Bug45923.phpt
new file mode 100644
index 0000000000..f59fdc4e39
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_variation3_Bug45923.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test mb_strripos() function : usage variations - pass different data types as $offset arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass mb_strripos different data types as $offset arg to test behaviour
+ */
+
+echo "*** Testing mb_strripos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = b'A';
+$haystack = b'string_val';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $offest argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 12.5,
+ -12.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ b"string",
+ b'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strripos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strripos($haystack, $needle, $input, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strripos() : usage variations ***
+
+-- Iteration 1 --
+int(8)
+
+-- Iteration 2 --
+int(8)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+int(8)
+
+-- Iteration 9 --
+int(8)
+
+-- Iteration 10 --
+int(8)
+
+-- Iteration 11 --
+int(8)
+
+-- Iteration 12 --
+int(8)
+
+-- Iteration 13 --
+int(8)
+
+-- Iteration 14 --
+int(8)
+
+-- Iteration 15 --
+int(8)
+
+-- Iteration 16 --
+
+Warning: mb_strripos() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strripos() expects parameter 3 to be long, Unicode string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: mb_strripos() expects parameter 3 to be long, binary string given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: mb_strripos() expects parameter 3 to be long, binary string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: mb_strripos() expects parameter 3 to be long, binary string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: mb_strripos() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+int(8)
+
+-- Iteration 23 --
+int(8)
+
+-- Iteration 24 --
+
+Warning: mb_strripos() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_strripos_variation4.phpt b/ext/mbstring/tests/mb_strripos_variation4.phpt
new file mode 100644
index 0000000000..2b72b85061
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_variation4.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test mb_strripos() function : usage variations - pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass mb_strripos different data types as $encoding arg to test behaviour
+ * Where possible 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_strripos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = b'string_val';
+$needle = b'VaL';
+$offset = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strripos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strripos($haystack, $needle, $offset, $input));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strripos() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(7)
+
+-- Iteration 19 --
+int(7)
+
+-- Iteration 20 --
+int(7)
+
+-- Iteration 21 --
+int(7)
+
+-- Iteration 22 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Illegal character encoding specified in %s on line %d
+
+Warning: mb_strripos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strripos() expects parameter 4 to be binary string, resource given in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
new file mode 100644
index 0000000000..02792554eb
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test mb_strripos() function : usage variations - Pass different integers as $offset argument
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strripos(string haystack, string needle [, int offset [, string encoding]])
+ * Description: Finds position of last occurrence of a string within another, case insensitive
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+/*
+ * Test how mb_strripos() behaves when passed different integers as $offset argument
+ * The character length of $string_ascii and $string_mb is the same,
+ * and the needle appears at the same positions in both strings
+ */
+
+mb_internal_encoding('UTF-8');
+
+echo "*** Testing mb_strripos() : usage variations ***\n";
+
+$string_ascii = b'+Is an English string'; //21 chars
+$needle_ascii = b'G';
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
+$needle_mb = base64_decode('44CC');
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * mb_strripos should not be able to accept negative values as $offset.
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -10; $i <= 60; $i += 10) {
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ var_dump(mb_strripos($string_ascii, $needle_ascii, $i));
+ echo "--Multibyte String --\n";
+ var_dump(mb_strripos($string_mb, $needle_mb, $i, 'UTF-8'));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strripos() : usage variations ***
+
+**-- Offset is: -10 --**
+-- ASCII String --
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 0 --**
+-- ASCII String --
+int(20)
+--Multibyte String --
+int(20)
+
+**-- Offset is: 10 --**
+-- ASCII String --
+int(20)
+--Multibyte String --
+int(20)
+
+**-- Offset is: 20 --**
+-- ASCII String --
+int(20)
+--Multibyte String --
+int(20)
+
+**-- Offset is: 30 --**
+-- ASCII String --
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 40 --**
+-- ASCII String --
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 50 --**
+-- ASCII String --
+bool(false)
+--Multibyte String --
+bool(false)
+
+**-- Offset is: 60 --**
+-- ASCII String --
+bool(false)
+--Multibyte String --
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_strrpos_basic.phpt b/ext/mbstring/tests/mb_strrpos_basic.phpt
index 622b55dbf7..ec6b86c292 100644
--- a/ext/mbstring/tests/mb_strrpos_basic.phpt
+++ b/ext/mbstring/tests/mb_strrpos_basic.phpt
@@ -20,15 +20,15 @@ echo "*** Testing mb_strrpos() : basic ***\n";
mb_internal_encoding('UTF-8');
-$string_ascii = 'This is an English string. 0123456789.';
+$string_ascii = b'This is an English string. 0123456789.';
//Japanese string in UTF-8
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
echo "\n-- ASCII string 1 --\n";
-var_dump(mb_strrpos($string_ascii, 'is', 4, 'ISO-8859-1'));
+var_dump(mb_strrpos($string_ascii, b'is', 4, 'ISO-8859-1'));
echo "\n-- ASCII string 2 --\n";
-var_dump(mb_strrpos($string_ascii, 'hello, world'));
+var_dump(mb_strrpos($string_ascii, b'hello, world'));
echo "\n-- Multibyte string 1 --\n";
$needle1 = base64_decode('44CC');
@@ -40,7 +40,7 @@ var_dump(mb_strrpos($string_mb, $needle2));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_strrpos() : basic ***
-- ASCII string 1 --
@@ -55,3 +55,4 @@ int(20)
-- Multibyte string 2 --
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_strrpos_variation1.phpt b/ext/mbstring/tests/mb_strrpos_variation1.phpt
index 0b77503373..e812a2b327 100644
--- a/ext/mbstring/tests/mb_strrpos_variation1.phpt
+++ b/ext/mbstring/tests/mb_strrpos_variation1.phpt
@@ -19,7 +19,7 @@ function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this
echo "*** Testing mb_strrpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$needle = 'world';
+$needle = b'world';
$offset = 0;
$encoding = 'utf-8';
@@ -36,7 +36,7 @@ class classA
}
// heredoc string
-$heredoc = <<<EOT
+$heredoc = b<<<EOT
hello, world
EOT;
@@ -74,8 +74,8 @@ $inputs = array(
'',
// string data
-/*18*/ "hello, world",
- 'hello, world',
+/*18*/ b"hello, world",
+ b'hello, world',
$heredoc,
// object data
@@ -179,3 +179,4 @@ bool(false)
Warning: mb_strrpos() expects parameter 1 to be binary string, resource given in %s on line %d
bool(false)
Done
+
diff --git a/ext/mbstring/tests/mb_strrpos_variation3.phpt b/ext/mbstring/tests/mb_strrpos_variation3.phpt
index 97e3b25a99..6728c113c4 100644
--- a/ext/mbstring/tests/mb_strrpos_variation3.phpt
+++ b/ext/mbstring/tests/mb_strrpos_variation3.phpt
@@ -19,8 +19,8 @@ function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this
echo "*** Testing mb_strrpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$needle = 'a';
-$haystack = 'string_val';
+$needle = b'a';
+$haystack = b'string_val';
$encoding = 'utf-8';
//get an unset variable
@@ -31,12 +31,12 @@ unset ($unset_var);
class classA
{
public function __toString() {
- return "7";
+ return b"7";
}
}
// heredoc string
-$heredoc = <<<EOT
+$heredoc = b<<<EOT
hello world
EOT;
@@ -145,3 +145,4 @@ int(8)
-- Iteration 18 --
int(8)
Done
+
diff --git a/ext/mbstring/tests/mb_strrpos_variation4.phpt b/ext/mbstring/tests/mb_strrpos_variation4.phpt
index 321129b621..a90356d665 100644
--- a/ext/mbstring/tests/mb_strrpos_variation4.phpt
+++ b/ext/mbstring/tests/mb_strrpos_variation4.phpt
@@ -20,8 +20,8 @@ function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this
echo "*** Testing mb_strrpos() : usage variations ***\n";
// Initialise function arguments not being substituted
-$haystack = 'hello, world';
-$needle = 'world';
+$haystack = b'hello, world';
+$needle = b'world';
$offset = 0;
//get an unset variable
@@ -219,4 +219,4 @@ bool(false)
Warning: mb_strrpos() expects parameter 4 to be binary string, resource given in %s on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strstr_basic.phpt b/ext/mbstring/tests/mb_strstr_basic.phpt
new file mode 100644
index 0000000000..3793358928
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_basic.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test mb_strstr() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : basic functionality ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = b'abc def';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string: needle exists --\n";
+var_dump(bin2hex(mb_strstr($string_ascii, b'd', false, 'ISO-8859-1')));
+var_dump(bin2hex(mb_strstr($string_ascii, b'd')));
+var_dump(bin2hex(mb_strstr($string_ascii, b'd', true)));
+
+
+echo "\n-- ASCII string: needle doesn't exist --\n";
+var_dump(mb_strstr($string_ascii, b'123'));
+
+echo "\n-- Multibyte string: needle exists --\n";
+$needle1 = base64_decode('5pel5pys6Kqe');
+var_dump(bin2hex(mb_strstr($string_mb, $needle1)));
+var_dump(bin2hex(mb_strstr($string_mb, $needle1, false, 'utf-8')));
+var_dump(bin2hex(mb_strstr($string_mb, $needle1, true)));
+
+
+echo "\n-- Multibyte string: needle doesn't exist --\n";
+$needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
+var_dump(mb_strstr($string_mb, $needle2));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strstr() : basic functionality ***
+
+-- ASCII string: needle exists --
+unicode(6) "646566"
+unicode(6) "646566"
+unicode(8) "61626320"
+
+-- ASCII string: needle doesn't exist --
+bool(false)
+
+-- Multibyte string: needle exists --
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+unicode(0) ""
+
+-- Multibyte string: needle doesn't exist --
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strstr_error1.phpt b/ext/mbstring/tests/mb_strstr_error1.phpt
new file mode 100644
index 0000000000..f38d5c9ccd
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_strstr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : error conditions ***\n";
+
+
+//Test mb_strstr with one more than the expected number of arguments
+echo "\n-- Testing mb_strstr() function with more than expected no. of arguments --\n";
+$haystack = b'string_val';
+$needle = b'string_val';
+$part = true;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strstr($haystack, $needle, $part, $encoding, $extra_arg) );
+
+// Testing mb_strstr with one less than the expected number of arguments
+echo "\n-- Testing mb_strstr() function with less than expected no. of arguments --\n";
+$haystack = b'string_val';
+var_dump( mb_strstr($haystack) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : error conditions ***
+
+-- Testing mb_strstr() function with more than expected no. of arguments --
+
+Warning: mb_strstr() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strstr() function with less than expected no. of arguments --
+
+Warning: mb_strstr() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_error2.phpt b/ext/mbstring/tests/mb_strstr_error2.phpt
new file mode 100644
index 0000000000..163c80026a
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_strstr() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : error conditions ***\n";
+
+
+echo "\n-- Testing mb_strstr() with unknown encoding --\n";
+$haystack = b'Hello, world';
+$needle = b'world';
+$encoding = 'unknown-encoding';
+$part = true;
+var_dump( mb_strstr($haystack, $needle, $part, $encoding) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : error conditions ***
+
+-- Testing mb_strstr() with unknown encoding --
+
+Warning: mb_strstr(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation1.phpt b/ext/mbstring/tests/mb_strstr_variation1.phpt
new file mode 100644
index 0000000000..cd946f8c10
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation1.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test mb_strstr() function : usage variation - various haystacks, needle won't be found
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$needle = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for haystack
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strstr($value, $needle, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+bool(false)
+
+--lowercase null--
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+bool(false)
+
+--empty string DQ--
+bool(false)
+
+--empty string SQ--
+bool(false)
+
+--instance of classWithToString--
+Error: 4096 - Method classWithToString::__toString() must return a string value, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+bool(false)
+
+--unset var--
+bool(false)
+
+--resource--
+Error: 2 - mb_strstr() expects parameter 1 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_strstr_variation2.phpt b/ext/mbstring/tests/mb_strstr_variation2.phpt
new file mode 100644
index 0000000000..fb84ff5ad4
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation2.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test mb_strstr() function : usage variation - different types of needle.
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$part = true;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for needle
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strstr($haystack, $value, $part, $encoding) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : usage variation ***
+
+--int 0--
+bool(false)
+
+--int 1--
+bool(false)
+
+--int 12345--
+bool(false)
+
+--int -12345--
+bool(false)
+
+--float 10.5--
+bool(false)
+
+--float -10.5--
+bool(false)
+
+--float 12.3456789000e10--
+bool(false)
+
+--float -12.3456789000e10--
+bool(false)
+
+--float .5--
+bool(false)
+
+--empty array--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--lowercase true--
+bool(false)
+
+--lowercase false--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--uppercase TRUE--
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 4096 - Method classWithToString::__toString() must return a string value, %s(%d)
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_strstr(): Empty delimiter., %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_strstr() expects parameter 2 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_strstr_variation3.phpt b/ext/mbstring/tests/mb_strstr_variation3.phpt
new file mode 100644
index 0000000000..c8f89bdbd6
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test mb_strstr() function : usage variation - different values for part
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return b"Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = b<<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for part
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = mb_strstr($haystack, $needle, $value, $encoding);
+ if ($res === false) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : usage variation ***
+
+--int 0--
+unicode(8) "5f76616c"
+
+--int 1--
+unicode(12) "737472696e67"
+
+--int 12345--
+unicode(12) "737472696e67"
+
+--int -12345--
+unicode(12) "737472696e67"
+
+--float 10.5--
+unicode(12) "737472696e67"
+
+--float -10.5--
+unicode(12) "737472696e67"
+
+--float 12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float -12.3456789000e10--
+unicode(12) "737472696e67"
+
+--float .5--
+unicode(12) "737472696e67"
+
+--empty array--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+unicode(8) "5f76616c"
+
+--lowercase null--
+unicode(8) "5f76616c"
+
+--lowercase true--
+unicode(12) "737472696e67"
+
+--lowercase false--
+unicode(8) "5f76616c"
+
+--uppercase TRUE--
+unicode(12) "737472696e67"
+
+--uppercase FALSE--
+unicode(8) "5f76616c"
+
+--empty string DQ--
+unicode(8) "5f76616c"
+
+--empty string SQ--
+unicode(8) "5f76616c"
+
+--string DQ--
+unicode(12) "737472696e67"
+
+--string SQ--
+unicode(12) "737472696e67"
+
+--mixed case string--
+unicode(12) "737472696e67"
+
+--heredoc--
+unicode(12) "737472696e67"
+
+--instance of classWithToString--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, object given, %s(%d)
+bool(false)
+
+--undefined var--
+unicode(8) "5f76616c"
+
+--unset var--
+unicode(8) "5f76616c"
+
+--resource--
+Error: 2 - mb_strstr() expects parameter 3 to be boolean, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation4.phpt b/ext/mbstring/tests/mb_strstr_variation4.phpt
new file mode 100644
index 0000000000..073d194936
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation4.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test mb_strstr() function : usage variation - different encoding types
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$haystack = b'string_val';
+$needle = b'_';
+$part = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "invalid";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+invalid
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for encoding
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_strstr($haystack, $needle, $part, $value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_strstr() : usage variation ***
+
+--int 0--
+Error: 2 - mb_strstr(): Unknown encoding "0", %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - mb_strstr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - mb_strstr(): Unknown encoding "12345", %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - mb_strstr(): Unknown encoding "-2345", %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - mb_strstr(): Unknown encoding "10.5", %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - mb_strstr(): Unknown encoding "-10.5", %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - mb_strstr(): Unknown encoding "123456789000", %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - mb_strstr(): Unknown encoding "-123456789000", %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - mb_strstr(): Unknown encoding "0.5", %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--int indexed array--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--associative array--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--nested arrays--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, array given, %s(%d)
+bool(false)
+
+--uppercase NULL--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - mb_strstr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - mb_strstr(): Unknown encoding "1", %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - mb_strstr(): Unknown encoding "invalid", %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, object given, %s(%d)
+bool(false)
+
+--undefined var--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_strstr(): Unknown encoding "", %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - mb_strstr() expects parameter 4 to be binary string, resource given, %s(%d)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation5.phpt b/ext/mbstring/tests/mb_strstr_variation5.phpt
new file mode 100644
index 0000000000..9f4ba0812f
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation5.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test mb_strstr() function : variation - multiple needles
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : variation ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//with repeated needles
+$string_ascii = b'abcdef zbcdyx';
+$needle_ascii = b"bcd";
+
+//Japanese string in UTF-8 with repeated needles
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OIMzTvvJXvvJbml6XmnKzoqp7jg4bjgq3jgrnjg4g=');
+$needle_mb = base64_decode('6Kqe44OG44Kt');
+
+echo "-- Ascii data --\n";
+var_dump(bin2hex(mb_strstr($string_ascii, $needle_ascii, false)));
+var_dump(bin2hex(mb_strstr($string_ascii, $needle_ascii, true)));
+
+echo "-- mb data in utf-8 --\n";
+$res = mb_strstr($string_mb, $needle_mb, false);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+$res = mb_strstr($string_mb, $needle_mb, true);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strstr() : variation ***
+-- Ascii data --
+unicode(24) "6263646566207a6263647978"
+unicode(2) "61"
+-- mb data in utf-8 --
+unicode(88) "e8aa9ee38386e382ade382b9e383883334efbc95efbc96e697a5e69cace8aa9ee38386e382ade382b9e38388"
+unicode(12) "e697a5e69cac"
+===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation6.phpt b/ext/mbstring/tests/mb_strstr_variation6.phpt
new file mode 100644
index 0000000000..b2827e8415
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_variation6.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test mb_strstr() function : variation - case sensitivity
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strstr(string haystack, string needle[, bool part[, string encoding]])
+ * Description: Finds first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_strstr() : variation ***\n";
+
+mb_internal_encoding('UTF-8');
+
+//ascii
+$string_ascii = b'abcdef';
+$needle_ascii_upper = b"BCD";
+$needle_ascii_mixed = b"bCd";
+$needle_ascii_lower = b"bcd";
+
+//Greek string in lower case UTF-8
+$string_mb = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
+$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
+$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
+
+echo "-- Ascii data --\n";
+// needle should be found
+var_dump(bin2hex(mb_strstr($string_ascii, $needle_ascii_lower)));
+// no needle should be found
+var_dump(mb_strstr($string_ascii, $needle_ascii_upper));
+var_dump(mb_strstr($string_ascii, $needle_ascii_mixed));
+
+echo "-- mb data in utf-8 --\n";
+// needle should be found
+$res = mb_strstr($string_mb, $needle_mb_lower, false);
+if ($res !== false) {
+ var_dump(bin2hex($res));
+}
+else {
+ echo "nothing found!\n";
+}
+// no needle should be found
+var_dump(mb_strstr($string_mb, $needle_mb_upper));
+var_dump(mb_strstr($string_mb, $needle_mb_mixed));
+
+
+?>
+===DONE===
+--EXPECT--
+*** Testing mb_strstr() : variation ***
+-- Ascii data --
+unicode(10) "6263646566"
+bool(false)
+bool(false)
+-- mb data in utf-8 --
+unicode(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/mbstring/tests/mb_strtolower_variation1.phpt b/ext/mbstring/tests/mb_strtolower_variation1.phpt
index f904fc1f11..d3aa08fc36 100644
--- a/ext/mbstring/tests/mb_strtolower_variation1.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation1.phpt
@@ -18,8 +18,6 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i
echo "*** Testing mb_strtolower() : usage variations ***\n";
-// Initialise function arguments not being substituted
-$encoding = 'UTF-8';
//get an unset variable
$unset_var = 10;
@@ -93,7 +91,7 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_strtolower($input, $encoding) );
+ var_dump( mb_strtolower($input) );
$iterator++;
};
@@ -178,3 +176,4 @@ string(0) ""
Warning: mb_strtolower() expects parameter 1 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_strtolower_variation2.phpt b/ext/mbstring/tests/mb_strtolower_variation2.phpt
index 9e33d948ef..0120e9b47c 100644
--- a/ext/mbstring/tests/mb_strtolower_variation2.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation2.phpt
@@ -20,7 +20,7 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i
echo "*** Testing mb_strtolower() : usage variations ***\n";
// Initialise function arguments not being substituted
-$sourcestring = 'Hello, World';
+$sourcestring = b'Hello, World';
//get an unset variable
$unset_var = 10;
@@ -94,7 +94,13 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_strtolower($sourcestring, $input) );
+ $res = mb_strtolower($sourcestring, $input);
+ if ($res === false || $res == NULL) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
$iterator++;
};
@@ -169,10 +175,10 @@ Warning: mb_strtolower(): Unknown encoding "0.5" in %s on line %d
bool(false)
-- Iteration 10 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 11 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 12 --
@@ -184,7 +190,7 @@ bool(false)
-- Iteration 13 --
Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 14 --
@@ -196,38 +202,39 @@ bool(false)
-- Iteration 15 --
Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 16 --
Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 17 --
Warning: mb_strtolower(): Illegal character encoding specified in %s on line %d
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 18 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 19 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 20 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 21 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 22 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 23 --
-string(12) "hello, world"
+unicode(24) "68656c6c6f2c20776f726c64"
-- Iteration 24 --
Warning: mb_strtolower() expects parameter 2 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_strtolower_variation4.phpt b/ext/mbstring/tests/mb_strtolower_variation4.phpt
index 93a2e0a23f..37357a1898 100644
--- a/ext/mbstring/tests/mb_strtolower_variation4.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation4.phpt
@@ -18,10 +18,10 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i
echo "*** Testing mb_strtolower() : usage variations ***\n";
-$uppers = array('Basic Latin' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+$uppers = array('Basic Latin' => b'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
-$lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
+$lowers = array('Basic Latin' => b'abcdefghijklmnopqrstuvwxyz',
'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
@@ -39,7 +39,7 @@ foreach ($uppers as $lang => $sourcestring) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_strtolower() : usage variations ***
-- Basic Latin --
@@ -53,4 +53,4 @@ Correctly Converted
-- Russian --
string(24) "0LDQsdCy0LPQtNC10LbQtw=="
Correctly Converted
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_basic.phpt b/ext/mbstring/tests/mb_strtoupper_basic.phpt
index 744afcc897..e77646923c 100644
--- a/ext/mbstring/tests/mb_strtoupper_basic.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_basic.phpt
@@ -19,14 +19,14 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
echo "*** Testing mb_strtoupper() : basic functionality ***\n";
mb_internal_encoding('utf-8');
-$ascii_lower = 'abcdefghijklmnopqrstuvwxyz';
-$ascii_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+$ascii_lower = b'abcdefghijklmnopqrstuvwxyz';
+$ascii_upper = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
$greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
echo "\n-- ASCII String --\n";
$ascii = mb_strtoupper($ascii_lower);
-var_dump($ascii);
+var_dump(base64_encode($ascii));
if($ascii == $ascii_upper) {
echo "Correctly converted\n";
@@ -51,10 +51,10 @@ echo "Done";
*** Testing mb_strtoupper() : basic functionality ***
-- ASCII String --
-string(26) "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+string(36) "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="
Correctly converted
-- Multibyte String --
string(64) "zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p"
Correctly converted
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_variation1.phpt b/ext/mbstring/tests/mb_strtoupper_variation1.phpt
index f2d11dba1e..8338394e62 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation1.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation1.phpt
@@ -20,7 +20,6 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
echo "*** Testing mb_strtoupper() : usage variations ***\n";
// Initialise function arguments not being substituted
-$encoding = 'UTF-8';
//get an unset variable
$unset_var = 10;
@@ -94,7 +93,7 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_strtoupper($input, $encoding) );
+ var_dump( mb_strtoupper($input) );
$iterator++;
};
@@ -180,3 +179,4 @@ string(0) ""
Warning: mb_strtoupper() expects parameter 1 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_strtoupper_variation2.phpt b/ext/mbstring/tests/mb_strtoupper_variation2.phpt
index 6113705709..8094ad85f1 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation2.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation2.phpt
@@ -20,7 +20,7 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
echo "*** Testing mb_strtoupper() : usage variations ***\n";
// Initialise function arguments not being substituted
-$sourcestring = 'Hello, World';
+$sourcestring = b'Hello, World';
//get an unset variable
$unset_var = 10;
@@ -94,7 +94,13 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_strtoupper($sourcestring, $input) );
+ $res = mb_strtoupper($sourcestring, $input);
+ if ($res === false || $res == NULL) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
$iterator++;
};
@@ -170,10 +176,10 @@ Warning: mb_strtoupper(): Unknown encoding "0.5" in %s on line %d
bool(false)
-- Iteration 10 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 11 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 12 --
@@ -185,7 +191,7 @@ bool(false)
-- Iteration 13 --
Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 14 --
@@ -197,38 +203,39 @@ bool(false)
-- Iteration 15 --
Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 16 --
Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 17 --
Warning: mb_strtoupper(): Illegal character encoding specified in %s on line %d
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 18 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 19 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 20 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 21 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 22 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 23 --
-string(12) "HELLO, WORLD"
+unicode(24) "48454c4c4f2c20574f524c44"
-- Iteration 24 --
Warning: mb_strtoupper() expects parameter 2 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_strtoupper_variation4.phpt b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
index 1acae3be57..7d91c8a2de 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation4.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
@@ -19,10 +19,10 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
echo "*** Testing mb_strtoupper() : usage variations ***\n";
-$uppers = array('Basic Latin' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+$uppers = array('Basic Latin' => b'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
-$lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
+$lowers = array('Basic Latin' => b'abcdefghijklmnopqrstuvwxyz',
'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
@@ -40,7 +40,7 @@ foreach ($lowers as $lang => $sourcestring) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_strtoupper() : usage variations ***
-- Basic Latin --
@@ -54,4 +54,4 @@ Correctly Converted
-- Russian --
string(24) "0JDQkdCS0JPQlNCV0JbQlw=="
Correctly Converted
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substitute_character_basic.phpt b/ext/mbstring/tests/mb_substitute_character_basic.phpt
new file mode 100644
index 0000000000..03dc8512a5
--- /dev/null
+++ b/ext/mbstring/tests/mb_substitute_character_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test mb_substitute_character() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substitute_character') or die("skip mb_substitute_character() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : mixed mb_substitute_character([mixed substchar])
+ * Description: Sets the current substitute_character or returns the current substitute_character
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_substitute_character() : basic functionality ***\n";
+
+
+// Initialise all required variables
+var_dump( mb_substitute_character() );
+var_dump( mb_substitute_character(66) );
+var_dump( mb_substitute_character() );
+var_dump( mb_substitute_character(1234) );
+var_dump( mb_substitute_character() );
+var_dump( mb_substitute_character("none") );
+var_dump( mb_substitute_character() );
+var_dump( mb_substitute_character("b") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_substitute_character() : basic functionality ***
+int(63)
+bool(true)
+int(66)
+bool(true)
+int(1234)
+
+Warning: mb_substitute_character(): Unknown character. in %s on line %d
+bool(false)
+int(1234)
+
+Warning: mb_substitute_character(): Unknown character. in %s on line %d
+bool(false)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_substitute_character_error.phpt b/ext/mbstring/tests/mb_substitute_character_error.phpt
new file mode 100644
index 0000000000..2a816b8b2f
--- /dev/null
+++ b/ext/mbstring/tests/mb_substitute_character_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_substitute_character() function : error conditions
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substitute_character') or die("skip mb_substitute_character() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : mixed mb_substitute_character([mixed substchar])
+ * Description: Sets the current substitute_character or returns the current substitute_character
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_substitute_character() : error conditions ***\n";
+
+
+//Test mb_substitute_character with one more than the expected number of arguments
+echo "\n-- Testing mb_substitute_character() function with more than expected no. of arguments --\n";
+$substchar = 1;
+$extra_arg = 10;
+var_dump( mb_substitute_character($substchar, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_substitute_character() : error conditions ***
+
+-- Testing mb_substitute_character() function with more than expected no. of arguments --
+
+Warning: mb_substitute_character() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
new file mode 100644
index 0000000000..5f522bb43f
--- /dev/null
+++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
@@ -0,0 +1,239 @@
+--TEST--
+Test mb_substitute_character() function : usage variation
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substitute_character') or die("skip mb_substitute_character() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : mixed mb_substitute_character([mixed substchar])
+ * Description: Sets the current substitute_character or returns the current substitute_character
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_substitute_character() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for substchar
+
+mb_internal_encoding('utf-8');
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( mb_substitute_character($value) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_substitute_character() : usage variation ***
+
+--int 0--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--int 1--
+bool(true)
+
+--int 12345--
+bool(true)
+
+--int -12345--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--float 10.5--
+bool(true)
+
+--float -10.5--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--int indexed array--
+bool(true)
+
+--associative array--
+bool(true)
+
+--nested arrays--
+bool(true)
+
+--uppercase NULL--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--lowercase true--
+bool(true)
+
+--lowercase false--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--uppercase TRUE--
+bool(true)
+
+--uppercase FALSE--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--string DQ--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--string SQ--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--mixed case string--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--heredoc--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+bool(true)
+
+--instance of classWithoutToString--
+Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+bool(true)
+
+--undefined var--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - mb_substitute_character(): Unknown character., %s(%d)
+bool(false)
+
+--resource--
+bool(true)
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_substitute_character_variation2.phpt b/ext/mbstring/tests/mb_substitute_character_variation2.phpt
new file mode 100644
index 0000000000..be2219ba07
--- /dev/null
+++ b/ext/mbstring/tests/mb_substitute_character_variation2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test mb_substitute_character() function : variation unmappable out char for convert encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substitute_character') or die("skip mb_substitute_character() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : mixed mb_substitute_character([mixed substchar])
+ * Description: Sets the current substitute_character or returns the current substitute_character
+ * Source code: ext/mbstring/mbstring.c
+ * Alias to functions:
+ */
+
+echo "*** Testing mb_substitute_character() : variation ***\n";
+//japenese utf-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI');
+
+//output the default which is ? in ISO-8859-1, x3f
+var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8")));
+
+mb_substitute_character(66); //'B' in ISO-8859-1, x42
+var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8")));
+mb_substitute_character("none"); //no substitution
+var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8")));
+mb_substitute_character(280); //not valid in ISO-8859-1
+var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8")));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing mb_substitute_character() : variation ***
+unicode(14) "3f3f3f3f3f3f3f"
+unicode(14) "42424242424242"
+
+Warning: mb_substitute_character(): Unknown character. in %s on line %d
+unicode(14) "42424242424242"
+unicode(0) ""
+===DONE===
+
diff --git a/ext/mbstring/tests/mb_substr_count_variation1.phpt b/ext/mbstring/tests/mb_substr_count_variation1.phpt
index 9db4afd1ef..72aeef3443 100644
--- a/ext/mbstring/tests/mb_substr_count_variation1.phpt
+++ b/ext/mbstring/tests/mb_substr_count_variation1.phpt
@@ -21,7 +21,6 @@ echo "*** Testing mb_substr_count() : usage variations ***\n";
// Initialise function arguments not being substituted
$needle = 'world';
-$encoding = 'utf-8';
//get an unset variable
$unset_var = 10;
@@ -95,7 +94,7 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_substr_count($input, $needle, $encoding) );
+ var_dump( mb_substr_count($input, $needle) );
$iterator++;
};
diff --git a/ext/mbstring/tests/mb_substr_count_variation2.phpt b/ext/mbstring/tests/mb_substr_count_variation2.phpt
index 13abe42131..89832dbf91 100644
--- a/ext/mbstring/tests/mb_substr_count_variation2.phpt
+++ b/ext/mbstring/tests/mb_substr_count_variation2.phpt
@@ -20,7 +20,6 @@ echo "*** Testing mb_substr_count() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
$haystack = 'hello, world';
-$encoding = 'utf-8';
//get an unset variable
$unset_var = 10;
@@ -94,7 +93,7 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_substr_count($haystack, $input, $encoding) );
+ var_dump( mb_substr_count($haystack, $input) );
$iterator++;
};
@@ -194,4 +193,4 @@ bool(false)
Warning: mb_substr_count() expects parameter 2 to be binary string, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_variation3.phpt b/ext/mbstring/tests/mb_substr_count_variation3.phpt
index 75d485fdee..b3f7f9b2d8 100644
--- a/ext/mbstring/tests/mb_substr_count_variation3.phpt
+++ b/ext/mbstring/tests/mb_substr_count_variation3.phpt
@@ -20,8 +20,8 @@ function_exists('mb_substr_count') or die("skip mb_substr_count() is not availab
echo "*** Testing mb_substr_count() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
-$haystack = 'hello, world';
-$needle = 'world';
+$haystack = b'hello, world';
+$needle = b'world';
//get an unset variable
$unset_var = 10;
@@ -217,4 +217,4 @@ bool(false)
Warning: mb_substr_count() expects parameter 3 to be binary string, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_variation4.phpt b/ext/mbstring/tests/mb_substr_count_variation4.phpt
index e2a3fa7e60..624c95a956 100644
--- a/ext/mbstring/tests/mb_substr_count_variation4.phpt
+++ b/ext/mbstring/tests/mb_substr_count_variation4.phpt
@@ -22,8 +22,8 @@ echo "*** Testing mb_substr_count() : usage variations ***\n";
echo "\n-- ASCII String --\n";
-$string_ascii = 'abcabcabc';
-var_dump(mb_substr_count($string_ascii, 'abcabc')); //needle overlaps in haystack
+$string_ascii = b'abcabcabc';
+var_dump(mb_substr_count($string_ascii, b'abcabc')); //needle overlaps in haystack
echo "\n-- Multibyte String --\n";
$string_mb = base64_decode('5pel5pys6Kqe5pel5pys6Kqe5pel5pys6Kqe');
@@ -33,7 +33,7 @@ var_dump(mb_substr_count($string_mb, $needle_mb, 'utf-8'));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_substr_count() : usage variations ***
-- ASCII String --
@@ -41,4 +41,4 @@ int(1)
-- Multibyte String --
int(1)
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation1.phpt b/ext/mbstring/tests/mb_substr_variation1.phpt
index 1bcdbb5bfe..b739319484 100644
--- a/ext/mbstring/tests/mb_substr_variation1.phpt
+++ b/ext/mbstring/tests/mb_substr_variation1.phpt
@@ -21,7 +21,6 @@ echo "*** Testing mb_substr() : usage variations ***\n";
// Initialise function arguments not being substituted
$start = 0;
$length = 5;
-$encoding = 'utf-8';
//get an unset variable
$unset_var = 10;
@@ -95,7 +94,7 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_substr($input, $start, $length, $encoding));
+ var_dump( mb_substr($input, $start, $length));
$iterator++;
};
@@ -179,3 +178,4 @@ string(0) ""
Warning: mb_substr() expects parameter 1 to be binary string, resource given in %s on line %d
NULL
Done
+
diff --git a/ext/mbstring/tests/mb_substr_variation2.phpt b/ext/mbstring/tests/mb_substr_variation2.phpt
index 853baa64f1..2ddceb2d1c 100644
--- a/ext/mbstring/tests/mb_substr_variation2.phpt
+++ b/ext/mbstring/tests/mb_substr_variation2.phpt
@@ -20,7 +20,7 @@ function_exists('mb_substr') or die("skip mb_substr() is not available in this b
echo "*** Testing mb_substr() : usage variations ***\n";
// Initialise function arguments not being substituted
-$str = 'string_val';
+$str = b'string_val';
$start = 1;
$length = 5;
@@ -96,7 +96,13 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( mb_substr($str, $start, $length, $input));
+ $res = mb_substr($str, $start, $length, $input);
+ if ($res === false) {
+ var_dump($res);
+ }
+ else {
+ var_dump(bin2hex($res));
+ }
$iterator++;
};
@@ -192,16 +198,16 @@ Warning: mb_substr(): Unknown encoding "" in %s on line %d
bool(false)
-- Iteration 18 --
-string(5) "tring"
+unicode(10) "7472696e67"
-- Iteration 19 --
-string(5) "tring"
+unicode(10) "7472696e67"
-- Iteration 20 --
-string(5) "tring"
+unicode(10) "7472696e67"
-- Iteration 21 --
-string(5) "tring"
+unicode(10) "7472696e67"
-- Iteration 22 --
@@ -216,5 +222,6 @@ bool(false)
-- Iteration 24 --
Warning: mb_substr() expects parameter 4 to be binary string, resource given in %s on line %d
-NULL
+unicode(0) ""
Done
+
diff --git a/ext/mbstring/tests/mb_substr_variation4.phpt b/ext/mbstring/tests/mb_substr_variation4.phpt
index 6eadc49171..c4a723a0a1 100644
--- a/ext/mbstring/tests/mb_substr_variation4.phpt
+++ b/ext/mbstring/tests/mb_substr_variation4.phpt
@@ -20,7 +20,7 @@ echo "*** Testing mb_substr() : usage variations ***\n";
mb_internal_encoding('UTF-8');
-$string_ascii = '+Is an English string'; //21 chars
+$string_ascii = b'+Is an English string'; //21 chars
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
@@ -35,7 +35,8 @@ for ($i = -60; $i <= 60; $i += 10) {
}
echo "\n**-- Offset is: $i --**\n";
echo "-- ASCII String --\n";
- var_dump($a = mb_substr($string_ascii, $i, 4));
+ $a = mb_substr($string_ascii, $i, 4);
+ var_dump(base64_encode($a));
echo "--Multibyte String --\n";
$b = mb_substr($string_mb, $i, 4, 'UTF-8');
if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
@@ -53,55 +54,55 @@ echo "Done";
**-- Offset is: -60 --**
-- ASCII String --
-string(4) "+Is "
+string(8) "K0lzIA=="
--Multibyte String --
string(16) "5pel5pys6Kqe44OG"
**-- Offset is: -50 --**
-- ASCII String --
-string(4) "+Is "
+string(8) "K0lzIA=="
--Multibyte String --
string(16) "5pel5pys6Kqe44OG"
**-- Offset is: -40 --**
-- ASCII String --
-string(4) "+Is "
+string(8) "K0lzIA=="
--Multibyte String --
string(16) "5pel5pys6Kqe44OG"
**-- Offset is: -30 --**
-- ASCII String --
-string(4) "+Is "
+string(8) "K0lzIA=="
--Multibyte String --
string(16) "5pel5pys6Kqe44OG"
**-- Offset is: -20 --**
-- ASCII String --
-string(4) "Is a"
+string(8) "SXMgYQ=="
--Multibyte String --
string(16) "5pys6Kqe44OG44Kt"
**-- Offset is: -10 --**
-- ASCII String --
-string(4) "ish "
+string(8) "aXNoIA=="
--Multibyte String --
string(8) "MTIzNA=="
**-- Offset is: 0 --**
-- ASCII String --
-string(4) "+Is "
+string(8) "K0lzIA=="
--Multibyte String --
string(16) "5pel5pys6Kqe44OG"
**-- Offset is: 10 --**
-- ASCII String --
-string(4) "lish"
+string(8) "bGlzaA=="
--Multibyte String --
string(8) "MDEyMw=="
**-- Offset is: 20 --**
-- ASCII String --
-string(1) "g"
+string(4) "Zw=="
--Multibyte String --
string(4) "44CC"
@@ -128,4 +129,4 @@ string(0) ""
string(0) ""
--Multibyte String --
string(0) ""
-Done
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation5.phpt b/ext/mbstring/tests/mb_substr_variation5.phpt
index 9748c7ef0c..11caa9cab3 100644
--- a/ext/mbstring/tests/mb_substr_variation5.phpt
+++ b/ext/mbstring/tests/mb_substr_variation5.phpt
@@ -6,7 +6,6 @@ extension_loaded('mbstring') or die('skip');
function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
?>
--FILE--
-
<?php
/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
* Description: Returns part of a string
@@ -21,7 +20,7 @@ echo "*** Testing mb_substr() : usage variations ***\n";
mb_internal_encoding('UTF-8');
-$string_ascii = '+Is an English string'; //21 chars
+$string_ascii = b'+Is an English string'; //21 chars
//Japanese string, 21 characters
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
@@ -37,7 +36,8 @@ for ($i = -60; $i <= 60; $i += 10) {
}
echo "\n**-- Offset is: $i --**\n";
echo "-- ASCII String --\n";
- var_dump($a = mb_substr($string_ascii, 1, $i));
+ $a = mb_substr($string_ascii, 1, $i);
+ var_dump(base64_encode($a));
echo "--Multibyte String --\n";
$b = mb_substr($string_mb, 1, $i, 'UTF-8');
if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
@@ -50,7 +50,6 @@ for ($i = -60; $i <= 60; $i += 10) {
echo "Done";
?>
-
--EXPECT--
*** Testing mb_substr() : usage variations ***
@@ -86,7 +85,7 @@ string(0) ""
**-- Offset is: -10 --**
-- ASCII String --
-string(10) "Is an Engl"
+string(16) "SXMgYW4gRW5nbA=="
--Multibyte String --
string(40) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMA=="
@@ -98,37 +97,37 @@ string(0) ""
**-- Offset is: 10 --**
-- ASCII String --
-string(10) "Is an Engl"
+string(16) "SXMgYW4gRW5nbA=="
--Multibyte String --
string(40) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMA=="
**-- Offset is: 20 --**
-- ASCII String --
-string(20) "Is an English string"
+string(28) "SXMgYW4gRW5nbGlzaCBzdHJpbmc="
--Multibyte String --
string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
**-- Offset is: 30 --**
-- ASCII String --
-string(20) "Is an English string"
+string(28) "SXMgYW4gRW5nbGlzaCBzdHJpbmc="
--Multibyte String --
string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
**-- Offset is: 40 --**
-- ASCII String --
-string(20) "Is an English string"
+string(28) "SXMgYW4gRW5nbGlzaCBzdHJpbmc="
--Multibyte String --
string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
**-- Offset is: 50 --**
-- ASCII String --
-string(20) "Is an English string"
+string(28) "SXMgYW4gRW5nbGlzaCBzdHJpbmc="
--Multibyte String --
string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
**-- Offset is: 60 --**
-- ASCII String --
-string(20) "Is an English string"
+string(28) "SXMgYW4gRW5nbGlzaCBzdHJpbmc="
--Multibyte String --
string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation6.phpt b/ext/mbstring/tests/mb_substr_variation6.phpt
new file mode 100644
index 0000000000..b50b14982a
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation6.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test mb_substr() function : usage variations - pass different integers to $start arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test how mb_substr() behaves when passed a range of integers as $start argument
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = b'+Is an English string'; //21 chars
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -60; $i <= 60; $i += 10) {
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, $i, 4);
+ if ($a !== false) {
+ var_dump(bin2hex($a));
+ }
+ else {
+ var_dump($a);
+ }
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, $i, 4, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(bin2hex($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
+
+}
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing mb_substr() : usage variations ***
+
+**-- Offset is: -60 --**
+-- ASCII String --
+unicode(8) "2b497320"
+--Multibyte String --
+unicode(24) "e697a5e69cace8aa9ee38386"
+
+**-- Offset is: -50 --**
+-- ASCII String --
+unicode(8) "2b497320"
+--Multibyte String --
+unicode(24) "e697a5e69cace8aa9ee38386"
+
+**-- Offset is: -40 --**
+-- ASCII String --
+unicode(8) "2b497320"
+--Multibyte String --
+unicode(24) "e697a5e69cace8aa9ee38386"
+
+**-- Offset is: -30 --**
+-- ASCII String --
+unicode(8) "2b497320"
+--Multibyte String --
+unicode(24) "e697a5e69cace8aa9ee38386"
+
+**-- Offset is: -20 --**
+-- ASCII String --
+unicode(8) "49732061"
+--Multibyte String --
+unicode(24) "e69cace8aa9ee38386e382ad"
+
+**-- Offset is: -10 --**
+-- ASCII String --
+unicode(8) "69736820"
+--Multibyte String --
+unicode(8) "31323334"
+
+**-- Offset is: 0 --**
+-- ASCII String --
+unicode(8) "2b497320"
+--Multibyte String --
+unicode(24) "e697a5e69cace8aa9ee38386"
+
+**-- Offset is: 10 --**
+-- ASCII String --
+unicode(8) "6c697368"
+--Multibyte String --
+unicode(8) "30313233"
+
+**-- Offset is: 20 --**
+-- ASCII String --
+unicode(2) "67"
+--Multibyte String --
+unicode(6) "e38082"
+
+**-- Offset is: 30 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: 40 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: 50 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: 60 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation7.phpt b/ext/mbstring/tests/mb_substr_variation7.phpt
new file mode 100644
index 0000000000..0bb2544c14
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation7.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test mb_substr() function : usage variations - pass different integers to $length arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test how mb_substr() behaves when passed a range of integers as $length argument
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = b'+Is an English string'; //21 chars
+
+//Japanese string, 21 characters
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -60; $i <= 60; $i += 10) {
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, 1, $i);
+ if ($a !== false) {
+ var_dump(bin2hex($a));
+ }
+ else {
+ var_dump($a);
+ }
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, 1, $i, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(bin2hex($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
+
+}
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing mb_substr() : usage variations ***
+
+**-- Offset is: -60 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: -50 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: -40 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: -30 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: -20 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: -10 --**
+-- ASCII String --
+unicode(20) "497320616e20456e676c"
+--Multibyte String --
+unicode(56) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e3808230"
+
+**-- Offset is: 0 --**
+-- ASCII String --
+unicode(0) ""
+--Multibyte String --
+unicode(0) ""
+
+**-- Offset is: 10 --**
+-- ASCII String --
+unicode(20) "497320616e20456e676c"
+--Multibyte String --
+unicode(56) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e3808230"
+
+**-- Offset is: 20 --**
+-- ASCII String --
+unicode(40) "497320616e20456e676c69736820737472696e67"
+--Multibyte String --
+unicode(100) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+
+**-- Offset is: 30 --**
+-- ASCII String --
+unicode(40) "497320616e20456e676c69736820737472696e67"
+--Multibyte String --
+unicode(100) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+
+**-- Offset is: 40 --**
+-- ASCII String --
+unicode(40) "497320616e20456e676c69736820737472696e67"
+--Multibyte String --
+unicode(100) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+
+**-- Offset is: 50 --**
+-- ASCII String --
+unicode(40) "497320616e20456e676c69736820737472696e67"
+--Multibyte String --
+unicode(100) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+
+**-- Offset is: 60 --**
+-- ASCII String --
+unicode(40) "497320616e20456e676c69736820737472696e67"
+--Multibyte String --
+unicode(100) "e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
+Done \ No newline at end of file