diff --git a/tests/std/strings/004.phpt b/tests/std/strings/004.phpt new file mode 100644 index 00000000..8e66a398 --- /dev/null +++ b/tests/std/strings/004.phpt @@ -0,0 +1,88 @@ +--TEST-- +Testing randomization of shuffle() and str_shuffle(). +--SKIPIF-- + +--FILE-- + $v) + print "$k: $v: " . sprintf('%0.3f', $v / $times) . "\n"; +} +$a = array(); +$times = 90000; +for ($i = 0; $i < $times; $i++) { + $p = range(1,4); + shuffle($p); + $s = join('', $p); + if (empty($a[$s])) $a[$s] = 0; + $a[$s]++; +} + +stats('shuffle', $a); +$a = array(); +$times = 90000; +for ($i = 0; $i < $times; $i++) { + $p = '1234'; + $s = str_shuffle($p); + if (empty($a[$s])) $a[$s] = 0; + $a[$s]++; +} + +stats('str_shuffle', $a); +?> +--EXPECTREGEX-- +shuffle +1234: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1243: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1324: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1342: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1423: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1432: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2134: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2143: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2314: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2341: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2413: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2431: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3124: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3142: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3214: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3241: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3412: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3421: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4123: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4132: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4213: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4231: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4312: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4321: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +str_shuffle +1234: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1243: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1324: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1342: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1423: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +1432: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2134: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2143: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2314: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2341: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2413: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +2431: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3124: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3142: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3214: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3241: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3412: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +3421: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4123: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4132: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4213: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4231: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4312: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] +4321: [34][0-9][0-9][0-9]: 0.0[3-4][0-9] diff --git a/tests/std/strings/005.phpt b/tests/std/strings/005.phpt new file mode 100644 index 00000000..ee93c8f6 --- /dev/null +++ b/tests/std/strings/005.phpt @@ -0,0 +1,28 @@ +--TEST-- +highlight_string(), output buffer and error level +--SKIPIF-- + +--INI-- +error_reporting=8192 +--FILE-- + +--EXPECT-- +hello +int(8192) +bool(false) +int(8192) +Done diff --git a/tests/std/strings/006.phpt b/tests/std/strings/006.phpt new file mode 100644 index 00000000..c5df2d5b --- /dev/null +++ b/tests/std/strings/006.phpt @@ -0,0 +1,21 @@ +--TEST-- +highlight_file() and output buffer +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: highlight_file(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA): Failed to open stream: %s006.php on line %d + +Warning: highlight_file(): Failed opening 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' for highlighting in %s006.php on line %d +bool(false) +bool(false) diff --git a/tests/std/strings/007-win32.phpt b/tests/std/strings/007-win32.phpt new file mode 100644 index 00000000..9fe9e482 --- /dev/null +++ b/tests/std/strings/007-win32.phpt @@ -0,0 +1,16 @@ +--TEST-- +php_strip_whitespace() and output buffer +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: php_strip_whitespace(%s): Failed to open stream: No such file or directory in %s on line %d +string(0) "" +bool(false) diff --git a/tests/std/strings/007.phpt b/tests/std/strings/007.phpt new file mode 100644 index 00000000..f0356805 --- /dev/null +++ b/tests/std/strings/007.phpt @@ -0,0 +1,18 @@ +--TEST-- +php_strip_whitespace() and output buffer +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: php_strip_whitespace(%s): Failed to open stream: File%Sname too long in %s007.php on line %d +string(0) "" +bool(false) diff --git a/tests/std/strings/add-and-stripcslashes.phpt b/tests/std/strings/add-and-stripcslashes.phpt new file mode 100644 index 00000000..79923f42 --- /dev/null +++ b/tests/std/strings/add-and-stripcslashes.phpt @@ -0,0 +1,23 @@ +--TEST-- +addcslashes() and stripcslashes() function +--FILE-- + +--EXPECT-- +kaboemkara! +foo\b\a\r\b\az +\f\o\o\[ \] +\zoo['\.'] +\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z +1 +5d diff --git a/tests/std/strings/add-and-stripslashes.phpt b/tests/std/strings/add-and-stripslashes.phpt new file mode 100644 index 00000000..4855ff02 --- /dev/null +++ b/tests/std/strings/add-and-stripslashes.phpt @@ -0,0 +1,20 @@ +--TEST-- +addslashes() and stripslashes() functions +--FILE-- + +--EXPECT-- +Normal: OK diff --git a/tests/std/strings/addcslashes_001.phpt b/tests/std/strings/addcslashes_001.phpt new file mode 100644 index 00000000..878ac4bf --- /dev/null +++ b/tests/std/strings/addcslashes_001.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test addcslashes() function (variation 1) +--INI-- +precision=14 +--FILE-- +getMessage(), "\n"; + } + $counter++; +} + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing addcslashes() for basic operations *** +-- Iteration 1 -- +string(37) "goodyear1\2345NULL%0truefalse\a \b + " +-- Iteration 2 -- +addcslashes(): Argument #2 ($characters) must be of type string, array given +-- Iteration 3 -- +string(39) "goodye\ar12345NULL%0truef\alse\\a \b + " +-- Iteration 4 -- +string(39) "goodyear12345NULL\000truefalse\a \b + " +-- Iteration 5 -- +string(37) "goodyear12345NULL%0truefalse\a \b\n " +-- Iteration 6 -- +string(37) "goodyear12345NULL%0truefalse\a \b +\r " +-- Iteration 7 -- +string(37) "goodyear12345NULL%0truefalse\a \b + \t" +-- Iteration 8 -- +string(41) "goodye\ar12345NULL%0truef\alse\\\a \\b + " +-- Iteration 9 -- +string(37) "goodyear12345NULL%0truefalse\a\v \b + " +-- Iteration 10 -- +string(39) "goodyear12345NULL%0truefalse\\a \\\b + " +-- Iteration 11 -- +string(37) "goodyear12345NULL%0truefalse\a \f\b + " +Done diff --git a/tests/std/strings/addcslashes_002.phpt b/tests/std/strings/addcslashes_002.phpt new file mode 100644 index 00000000..c1931cb0 --- /dev/null +++ b/tests/std/strings/addcslashes_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test addcslashes() function (variation 2) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +*** Testing addcslashes() with ASCII code between 0 and 31 *** +string(44) "goodyear12345NULL\000truefalse\a\v\f\b\n\r\t" + +*** Testing addcslashes() with objects *** +string(7) "O\bject" +Done diff --git a/tests/std/strings/addcslashes_003.phpt b/tests/std/strings/addcslashes_003.phpt new file mode 100644 index 00000000..8abcb358 --- /dev/null +++ b/tests/std/strings/addcslashes_003.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test addcslashes() function (variation 3) +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +*** Testing addcslashes() with miscellaneous input arguments *** +string(0) "" +string(0) "" +string(11) "kaboemkara!" +string(14) "foo\b\a\r\b\az" +string(11) "\f\o\o\[ \]" +string(10) "\zoo['\.']" +string(40) "\abcd\e\f\g\h\i\j\k\l\m\n\o\pqrstuvwxy\z" +string(6) "\1\2\3" +string(2) "\0" +string(1) "%0" +string(10) "-1.2\34578" +string(2) "\ " +string(22) "string\000with\000NULL" +Done diff --git a/tests/std/strings/addcslashes_005.phpt b/tests/std/strings/addcslashes_005.phpt new file mode 100644 index 00000000..15b7f7d9 --- /dev/null +++ b/tests/std/strings/addcslashes_005.phpt @@ -0,0 +1,16 @@ +--TEST-- +addcslashes(); function test with warning +--SKIPIF-- + +--CREDITS-- + marcosptf - +#phptestfest PHPSP on Google - Sao Paulo - Brazil - 2014-06-05 +--FILE-- + +--EXPECTF-- +Warning: addcslashes(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +\zoo['\.'] diff --git a/tests/std/strings/addslashes_basic.phpt b/tests/std/strings/addslashes_basic.phpt new file mode 100644 index 00000000..41bb25ca --- /dev/null +++ b/tests/std/strings/addslashes_basic.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test addslashes() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing addslashes() : basic functionality *** +string(16) "How\'s everybody" +string(17) "Are you \"JOHN\"?" +string(19) "c:\\php\\addslashes" +string(12) "hello\0world" +Done diff --git a/tests/std/strings/addslashes_variation2.phpt b/tests/std/strings/addslashes_variation2.phpt new file mode 100644 index 00000000..e5cb60a4 --- /dev/null +++ b/tests/std/strings/addslashes_variation2.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test addslashes() function : usage variations - strings with characters to be backslashed +--FILE-- +', + "hello\x00world", + + // heredoc strings + $heredoc_string, + $heredoc_null_string + ); + +$count = 1; +// looping to test for all strings in $str_array +foreach( $str_array as $str ) { + echo "\n-- Iteration $count --\n"; + var_dump( addslashes($str) ); + $count ++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing addslashes() : with various strings containing characters to be backslashed *** + +-- Iteration 1 -- +string(11) "Hello world" + +-- Iteration 2 -- +string(18) "how\'re you doing?" + +-- Iteration 3 -- +string(30) "don\'t disturb u\'r neighbours" + +-- Iteration 4 -- +string(34) "don\'t disturb u\'r neighbours\'\'" + +-- Iteration 5 -- +string(0) "" + +-- Iteration 6 -- +string(2) "\'" + +-- Iteration 7 -- +string(2) "\'" + +-- Iteration 8 -- +string(32) "he said, \"he will be on leave\"" + +-- Iteration 9 -- +string(34) "he said, \"\"he will be on leave\"" + +-- Iteration 10 -- +string(15) "\"\"\"PHP\"\"\"" + +-- Iteration 11 -- +string(0) "" + +-- Iteration 12 -- +string(2) "\"" + +-- Iteration 13 -- +string(2) "\"" + +-- Iteration 14 -- +string(7) "hello\"" + +-- Iteration 15 -- +string(26) "Is your name Ram\\Krishna?" + +-- Iteration 16 -- +string(9) "\\0.0.0.0" + +-- Iteration 17 -- +string(29) "c:\\php\\testcase\\addslashes" + +-- Iteration 18 -- +string(2) "\\" + +-- Iteration 19 -- +string(12) "hello\0world" + +-- Iteration 20 -- +string(9) "\0hello\0" + +-- Iteration 21 -- +string(9) "\0\0hello" + +-- Iteration 22 -- +string(2) "\0" + +-- Iteration 23 -- +string(13) "\'\\0.0.0.0\'" + +-- Iteration 24 -- +string(15) "\'\\0.0.0.0\'\0" + +-- Iteration 25 -- +string(15) "\0\'c:\\php\\\'" + +-- Iteration 26 -- +string(13) "\"\\0.0.0.0\"" + +-- Iteration 27 -- +string(17) "\"c:\\php\\\"\0\'" + +-- Iteration 28 -- +string(22) "\"hello\"\'world\'\0//" + +-- Iteration 29 -- +string(18) "0xABCDEF0123456789" + +-- Iteration 30 -- +string(2) "\0" + +-- Iteration 31 -- +string(18) "!@#$%&*@$%#&/;:,<>" + +-- Iteration 32 -- +string(12) "hello\0world" + +-- Iteration 33 -- +string(7%d) "This is line 1 of \'heredoc\' string +This is line 2 of \"heredoc\" string" + +-- Iteration 34 -- +string(0) "" +Done diff --git a/tests/std/strings/basename.phpt b/tests/std/strings/basename.phpt new file mode 100644 index 00000000..303aa6c2 --- /dev/null +++ b/tests/std/strings/basename.phpt @@ -0,0 +1,51 @@ +--TEST-- +basename() function +--FILE-- + +--EXPECTF-- +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) "bar" +string(3) ".gz" +string(3) ".gz" +string(3) ".gz" +string(7) "foo%0bar" +string(7) "foo%0bar" diff --git a/tests/std/strings/basename_basic.phpt b/tests/std/strings/basename_basic.phpt new file mode 100644 index 00000000..9bd97e4b --- /dev/null +++ b/tests/std/strings/basename_basic.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test basename() function : basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing basic operations *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(3) "bar" + +--Iteration 6-- +string(3) "bar" + +--Iteration 7-- +string(3) "bar" + +--Iteration 8-- +string(3) "bar" + +--Iteration 9-- +string(3) "bar" + +--Iteration 10-- +string(3) "bar" + +--Iteration 11-- +string(6) "bar.gz" + +--Iteration 12-- +string(3) "bar" + +--Iteration 13-- +string(3) "bar" + +--Iteration 14-- +string(3) "bar" + +--Iteration 15-- +string(3) "bar" + +--Iteration 16-- +string(3) "bar" + +--Iteration 17-- +string(3) "bar" + +--Iteration 18-- +string(3) "bar" + +--Iteration 19-- +string(3) "bar" + +--Iteration 20-- +string(3) ".gz" + +--Iteration 21-- +string(3) ".gz" + +--Iteration 22-- +string(3) ".gz" + +--Iteration 23-- +string(3) ".gz" + +--Iteration 24-- +string(3) ".gz" + +--Iteration 25-- +string(3) ".gz" + +--Iteration 26-- +string(7) "foo%0bar" + +--Iteration 27-- +string(7) "foo%0bar" + +--Iteration 28-- +string(7) "foo%0bar" + +--Iteration 29-- +string(7) "foo%0bar" + +--Iteration 30-- +string(4) "test" + +--Iteration 31-- +string(3) "bar" + +--Iteration 32-- +string(6) "bar.gz" +Done diff --git a/tests/std/strings/basename_invalid_path.phpt b/tests/std/strings/basename_invalid_path.phpt new file mode 100644 index 00000000..9ed81baf --- /dev/null +++ b/tests/std/strings/basename_invalid_path.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test basename() function : usage variations with invalid paths +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(2) "ff" +string(6) "61ff62" +Done diff --git a/tests/std/strings/basename_invalid_path_win.phpt b/tests/std/strings/basename_invalid_path_win.phpt new file mode 100644 index 00000000..9179f534 --- /dev/null +++ b/tests/std/strings/basename_invalid_path_win.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test basename() function : usage variations with invalid paths +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(1) "%c" +Done diff --git a/tests/std/strings/basename_variation.phpt b/tests/std/strings/basename_variation.phpt new file mode 100644 index 00000000..42a6eb72 --- /dev/null +++ b/tests/std/strings/basename_variation.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test basename() function : usage variations +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing possible variations in path and suffix *** + +--Iteration 1-- +string(3) "bar" + +--Iteration 2-- +string(3) "bar" + +--Iteration 3-- +string(3) "bar" + +--Iteration 4-- +string(3) "bar" + +--Iteration 5-- +string(7) "bar.tar" + +--Iteration 6-- +string(7) "bar.tar" + +--Iteration 7-- +string(7) "bar.tar" + +--Iteration 8-- +string(7) "bar.tar" + +--Iteration 9-- +string(7) "bar.tar" + +--Iteration 10-- +string(7) "bar.tar" + +--Iteration 11-- +string(7) "bar.tar" + +--Iteration 12-- +string(1) "t" + +--Iteration 13-- +string(7) "tbar.gz" + +--Iteration 14-- +string(7) "tbar.gz" + +--Iteration 15-- +string(7) "tbar.gz" + +--Iteration 16-- +string(7) "tbar.gz" + +--Iteration 17-- +string(10) "My Pics.gz" + +--Iteration 18-- +string(10) "My Pics.gz" + +--Iteration 19-- +string(3) "My " + +--Iteration 20-- +string(7) "My Pics" + +--Iteration 21-- +string(10) "My Pics.gz" + +--Iteration 22-- +string(10) "My Pics.gz" + +--Iteration 23-- +string(10) "My Pics.gz" + +--Iteration 24-- +string(10) "My Pics.gz" + +--Iteration 25-- +string(4) "10.5" + +--Iteration 26-- +string(2) "10" + +--Iteration 27-- +string(4) "10.5" + +--Iteration 28-- +string(2) "10" + +--Iteration 29-- +string(2) "10" + +--Iteration 30-- +string(4) "10.5" + +--Iteration 31-- +string(4) "10.5" + +--Iteration 32-- +string(5) "10.gz" + +--Iteration 33-- +string(1) "0" + +--Iteration 34-- +string(1) "0" + +--Iteration 35-- +string(6) "bar.gz" + +--Iteration 36-- +string(6) "bar.gz" + +--Iteration 37-- +string(6) "bar.gz" + +--Iteration 38-- +string(1) " " + +--Iteration 39-- +string(1) " " + +--Iteration 40-- +string(1) " " + +--Iteration 41-- +string(1) " " + +--Iteration 42-- +string(0) "" + +--Iteration 43-- +string(0) "" +Done diff --git a/tests/std/strings/bin2hex.phpt b/tests/std/strings/bin2hex.phpt new file mode 100644 index 00000000..dbc440c0 --- /dev/null +++ b/tests/std/strings/bin2hex.phpt @@ -0,0 +1,14 @@ +--TEST-- +bin2hex() function +--FILE-- + +--EXPECT-- +000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +616263 diff --git a/tests/std/strings/bin2hex_001.phpt b/tests/std/strings/bin2hex_001.phpt new file mode 100644 index 00000000..e73500a3 --- /dev/null +++ b/tests/std/strings/bin2hex_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +bin2hex(); function test +--CREDITS-- +marcosptf - +#phptestfest PHPSP on Google - Sao Paulo - Brazil - 2014-06-05 +--FILE-- + +--EXPECT-- +313233343536 diff --git a/tests/std/strings/bin2hex_basic.phpt b/tests/std/strings/bin2hex_basic.phpt new file mode 100644 index 00000000..b3975885 --- /dev/null +++ b/tests/std/strings/bin2hex_basic.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test bin2hex() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing bin2hex() : basic functionality *** +-- Iteration 1 -- +string(46) "4865726520697320612073696d706c6520737472696e67" +-- Iteration 2 -- +string(102) "09205468697320537472696e6720636f6e7461696e7320090920736f6d6520636f6e74726f6c20636861726163746572730d0a" +-- Iteration 3 -- +string(36) "9091009394909195969798999a9b9c9d9e9f" +-- Iteration 4 -- +string(46) "4865726520697320612073696d706c6520737472696e67" +-- Iteration 5 -- +string(112) "5c74205468697320537472696e6720636f6e7461696e73205c745c7420736f6d6520636f6e74726f6c20636861726163746572735c725c6e" +-- Iteration 6 -- +string(144) "5c7839305c7839315c7830305c7839335c7839345c7839305c7839315c7839355c7839365c7839375c7839385c7839395c7839615c7839625c7839635c7839645c7839655c783966" diff --git a/tests/std/strings/bug20108.phpt b/tests/std/strings/bug20108.phpt new file mode 100644 index 00000000..e0be12b2 --- /dev/null +++ b/tests/std/strings/bug20108.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #20108 (Segfault on printf statement) +--FILE-- + +--EXPECT-- +string(581) " boo +" diff --git a/tests/std/strings/bug20169.phpt b/tests/std/strings/bug20169.phpt new file mode 100644 index 00000000..fd5de0ee --- /dev/null +++ b/tests/std/strings/bug20169.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #20169 (implode() clobbers first argument) +--FILE-- + +--EXPECT-- +delimiter: | +delimiter: | diff --git a/tests/std/strings/bug20261.phpt b/tests/std/strings/bug20261.phpt new file mode 100644 index 00000000..3c03afb4 --- /dev/null +++ b/tests/std/strings/bug20261.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #20261 (str_rot13() changes too much) +--FILE-- + +--EXPECT-- +1: boo +2: boo +3: +1: boo +2: boo +3: obb diff --git a/tests/std/strings/bug20927.phpt b/tests/std/strings/bug20927.phpt new file mode 100644 index 00000000..7575f2af --- /dev/null +++ b/tests/std/strings/bug20927.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #20927 (Segfault on wordwrap statement) +--FILE-- + +--EXPECT-- +Length of original string: 130 +Length of break string: 352 +string(6799) "1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapX " diff --git a/tests/std/strings/bug20934.phpt b/tests/std/strings/bug20934.phpt new file mode 100644 index 00000000..e068d2a6 --- /dev/null +++ b/tests/std/strings/bug20934.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #20934 (htmlspecialchars returns latin1 from UTF-8) +--FILE-- + +--EXPECTF-- +c3a0c3a1 +c3a0c3a1 diff --git a/tests/std/strings/bug21338.phpt b/tests/std/strings/bug21338.phpt new file mode 100644 index 00000000..2809d430 --- /dev/null +++ b/tests/std/strings/bug21338.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #20934 (html_entity_decode() crash when "" is passed) +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/tests/std/strings/bug21453.phpt b/tests/std/strings/bug21453.phpt new file mode 100644 index 00000000..cf563dfa --- /dev/null +++ b/tests/std/strings/bug21453.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #21453 (handling of non-encoded <) +--FILE-- + + first cell before < first cell after + second cell before < second cell after +"; + +var_dump(strip_tags($test)); +?> +--EXPECTF-- +string(8%d) " + + first cell before < first cell after + second cell before < second cell after +" diff --git a/tests/std/strings/bug21730.phpt b/tests/std/strings/bug21730.phpt new file mode 100644 index 00000000..5d305243 --- /dev/null +++ b/tests/std/strings/bug21730.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #21730 (*scanf "%n" conversion flag gives string instead of integer) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + string(3) "ABC" + [1]=> + string(3) "DEF" + [2]=> + int(9) +} +array(3) { + [0]=> + string(3) "ABC" + [1]=> + string(3) "DEF" + [2]=> + int(9) +} diff --git a/tests/std/strings/bug21744.phpt b/tests/std/strings/bug21744.phpt new file mode 100644 index 00000000..925dac3f --- /dev/null +++ b/tests/std/strings/bug21744.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #21744 (strip_tags misses exclamation marks in alt text) +--FILE-- +test + +HERE; + +print strip_tags($test, ''); +print strip_tags($test, ''); +?> +--EXPECT-- +test +test diff --git a/tests/std/strings/bug22008.phpt b/tests/std/strings/bug22008.phpt new file mode 100644 index 00000000..0965337e --- /dev/null +++ b/tests/std/strings/bug22008.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #22008 (strip_tags() eliminates too much) +--FILE-- + + + +test + + +PHP! + + + +HERE; + +echo trim(strip_tags($html, ''))."\n"; +?> +--EXPECT-- +test + + +PHP! diff --git a/tests/std/strings/bug22187.phpt b/tests/std/strings/bug22187.phpt new file mode 100644 index 00000000..9b77569b --- /dev/null +++ b/tests/std/strings/bug22187.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #22187 (possible crash in number_format() function) +--FILE-- + +--EXPECT-- +string(3) "0.0" +string(1) "0" diff --git a/tests/std/strings/bug22207.phpt b/tests/std/strings/bug22207.phpt new file mode 100644 index 00000000..eddfa942 --- /dev/null +++ b/tests/std/strings/bug22207.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #22207 (missing 0 when using the e notation in *printf functions) +--FILE-- + +--EXPECT-- +1.10000e+0 +string(11) "1.10000e+0 +" diff --git a/tests/std/strings/bug22224.phpt b/tests/std/strings/bug22224.phpt new file mode 100644 index 00000000..7a14cd2a --- /dev/null +++ b/tests/std/strings/bug22224.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #22224 (implode changes object references in array) +--SKIPIF-- + +--INI-- +error_reporting=0 +--FILE-- +&$a, 1=>&$a); +var_dump(implode(",",$arr)); +var_dump($arr) +?> +--EXPECTF-- +string(13) "Object,Object" +array(2) { + [0]=> + &object(foo)#%d (0) { + } + [1]=> + &object(foo)#%d (0) { + } +} diff --git a/tests/std/strings/bug22227.phpt b/tests/std/strings/bug22227.phpt new file mode 100644 index 00000000..eb980f98 --- /dev/null +++ b/tests/std/strings/bug22227.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #22227 (printf() field limiters broke between 4.2.3 and 4.3.0) +--FILE-- + +--EXPECT-- +abc diff --git a/tests/std/strings/bug23650.phpt b/tests/std/strings/bug23650.phpt new file mode 100644 index 00000000..79502314 --- /dev/null +++ b/tests/std/strings/bug23650.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #23650 (strip_tags() removes hyphens) +--FILE-- + +2: +3: +4: +5:abc - def +6: + +HERE; + +echo strip_tags($str); +echo strip_tags($str, ''); +?> +--EXPECT-- +1: +2: +3: +4: +5:abc - def +6: +1: +2: +3: +4: +5:abc - def +6: diff --git a/tests/std/strings/bug23894_32bit.phpt b/tests/std/strings/bug23894_32bit.phpt new file mode 100644 index 00000000..d2d33f8e --- /dev/null +++ b/tests/std/strings/bug23894_32bit.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #23894 (sprintf() decimal specifiers problem) 32bit version +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(4) "-012" +string(8) "2d303132" +string(13) " 4294967284" +string(26) "20202034323934393637323834" diff --git a/tests/std/strings/bug23894_64bit.phpt b/tests/std/strings/bug23894_64bit.phpt new file mode 100644 index 00000000..3ae5ea66 --- /dev/null +++ b/tests/std/strings/bug23894_64bit.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #23894 (sprintf() decimal specifiers problem) 64bit version +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(4) "-012" +string(8) "2d303132" +string(20) "18446744073709551604" +string(40) "3138343436373434303733373039353531363034" diff --git a/tests/std/strings/bug24098.phpt b/tests/std/strings/bug24098.phpt new file mode 100644 index 00000000..5ae998cf --- /dev/null +++ b/tests/std/strings/bug24098.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #24098 (pathinfo() crash) +--FILE-- + +--EXPECTF-- +array(4) { + ["dirname"]=> + string(1) "%e" + ["basename"]=> + string(8) "dsds.asa" + ["extension"]=> + string(3) "asa" + ["filename"]=> + string(4) "dsds" +} diff --git a/tests/std/strings/bug24281.phpt b/tests/std/strings/bug24281.phpt new file mode 100644 index 00000000..66a30913 --- /dev/null +++ b/tests/std/strings/bug24281.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #24281 (str_replace count not returned if variable wasn't initialized) +--FILE-- + +--EXPECT-- +3 changes were made. +3 changes were made. diff --git a/tests/std/strings/bug24312.phpt b/tests/std/strings/bug24312.phpt new file mode 100644 index 00000000..fb1f494b --- /dev/null +++ b/tests/std/strings/bug24312.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #24208 (base64_decode() not skipping 0xF0 - 0xFF) +--FILE-- + +--EXPECT-- +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +string(100) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" diff --git a/tests/std/strings/bug25671.phpt b/tests/std/strings/bug25671.phpt new file mode 100644 index 00000000..c564fac2 --- /dev/null +++ b/tests/std/strings/bug25671.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #25671 (subarrays not copied correctly) +--FILE-- + +--EXPECTF-- +Warning: Array to string conversion in %s on line %d +a:4:{i:0;s:19:"This is strung one.";i:1;s:19:"This is strung two.";i:2;s:5:"Array";i:3;s:22:"This is a last strung.";} + +Warning: Array to string conversion in %s on line %d +a:4:{i:0;s:19:"This is strung one.";i:1;s:19:"This is strung two.";i:2;s:5:"Array";i:3;s:22:"This is a last strung.";} + +Warning: Array to string conversion in %s on line %d +a:4:{i:0;s:16:"Thisisstringone.";i:1;s:16:"Thisisstringtwo.";i:2;s:5:"Array";i:3;s:18:"Thisisalaststring.";} + +Warning: Array to string conversion in %s on line %d +a:4:{i:0;s:16:"Thisisstringone.";i:1;s:16:"Thisisstringtwo.";i:2;s:5:"Array";i:3;s:18:"Thisisalaststring.";} diff --git a/tests/std/strings/bug25707.phpt b/tests/std/strings/bug25707.phpt new file mode 100644 index 00000000..4954fb1a --- /dev/null +++ b/tests/std/strings/bug25707.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #25707 (html_entity_decode over-decodes &lt;) +--FILE-- + +--EXPECT-- +string(4) "<" +string(5) "&" +string(8) "&lt;" diff --git a/tests/std/strings/bug26878.phpt b/tests/std/strings/bug26878.phpt new file mode 100644 index 00000000..da6c0a2a --- /dev/null +++ b/tests/std/strings/bug26878.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #26878 (problem with multiple references to the same variable with different types) +--FILE-- + +--EXPECT-- +Int: 0 and as string: some string diff --git a/tests/std/strings/bug26973.phpt b/tests/std/strings/bug26973.phpt new file mode 100644 index 00000000..9de3be49 --- /dev/null +++ b/tests/std/strings/bug26973.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #26973 (*printf() '+' modifier problem) +--FILE-- + +--EXPECTREGEX-- +\+0200 +\-0200 +\+200\.000000 +\-200\.000000 +00200 +(4294967096|18446744073709551416) +--- +00200 +\-0200 +200\.000000 +\-200\.000000 +00200 +(4294967096|18446744073709551416) diff --git a/tests/std/strings/bug27276.phpt b/tests/std/strings/bug27276.phpt new file mode 100644 index 00000000..f27e1d56 --- /dev/null +++ b/tests/std/strings/bug27276.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #27276 (str_replace tries to use obscene amounts of ram) +--FILE-- + +--EXPECT-- +Alive! diff --git a/tests/std/strings/bug27278.phpt b/tests/std/strings/bug27278.phpt new file mode 100644 index 00000000..27ebedd9 --- /dev/null +++ b/tests/std/strings/bug27278.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #27278 (*printf() functions treat arguments as if passed by reference) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(2) "02" +string(2) "02" +string(2) "02" diff --git a/tests/std/strings/bug27295.phpt b/tests/std/strings/bug27295.phpt new file mode 100644 index 00000000..08629216 --- /dev/null +++ b/tests/std/strings/bug27295.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #27295 (memory leak inside sscanf()) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +foo = bar +bar = foo diff --git a/tests/std/strings/bug27457.phpt b/tests/std/strings/bug27457.phpt new file mode 100644 index 00000000..e9ac42e0 --- /dev/null +++ b/tests/std/strings/bug27457.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #27457 (Problem with strtr() and translation array) +--FILE-- + '0')); + echo $test; + $test = strtr($test, array('0' => '.')); + echo $test; + $test = strtr($test, '.', '0'); + echo $test; + $test = strtr($test, '0', '.'); + echo $test; +?> +--EXPECT-- +Dot in brackets [.] +Dot in brackets [0] +Dot in brackets [.] +Dot in brackets [0] +Dot in brackets [.] diff --git a/tests/std/strings/bug27675.phpt b/tests/std/strings/bug27675.phpt new file mode 100644 index 00000000..a5d4294b --- /dev/null +++ b/tests/std/strings/bug27675.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #27675 (str_ireplace segfaults when shrinking string) +--FILE-- +', '', '/* I am a comment*/'); +?> +--EXPECT-- + I am a comment*/ diff --git a/tests/std/strings/bug28386.phpt b/tests/std/strings/bug28386.phpt new file mode 100644 index 00000000..9c7c158b --- /dev/null +++ b/tests/std/strings/bug28386.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #28386 (wordwrap() wraps text 1 character too soon) +--FILE-- + +--EXPECT-- +Some text +Some text +Some text +Some text diff --git a/tests/std/strings/bug28633.phpt b/tests/std/strings/bug28633.phpt new file mode 100644 index 00000000..9dc83a40 --- /dev/null +++ b/tests/std/strings/bug28633.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #28633 (sprintf incorrectly adding padding to floats) +--FILE-- + +--EXPECT-- +00.02 +02.02 diff --git a/tests/std/strings/bug29075.phpt b/tests/std/strings/bug29075.phpt new file mode 100644 index 00000000..63a4fdb0 --- /dev/null +++ b/tests/std/strings/bug29075.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #29075 (strnatcmp() incorrectly handles whitespace) +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(0) diff --git a/tests/std/strings/bug29119.phpt b/tests/std/strings/bug29119.phpt new file mode 100644 index 00000000..8b419b81 --- /dev/null +++ b/tests/std/strings/bug29119.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #29119 (html_entity_decode() misbehaves with UTF-8) +--FILE-- + +--EXPECT-- +string(42) "e28082e28089e28098e280a0e280b2e28184e282ac" diff --git a/tests/std/strings/bug29538.phpt b/tests/std/strings/bug29538.phpt new file mode 100644 index 00000000..13065a4e --- /dev/null +++ b/tests/std/strings/bug29538.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #29538 (number_format and problem with 0) +--FILE-- + +--EXPECT-- +025 +1,23400 diff --git a/tests/std/strings/bug33076.phpt b/tests/std/strings/bug33076.phpt new file mode 100644 index 00000000..95525ff2 --- /dev/null +++ b/tests/std/strings/bug33076.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #33076 (str_ireplace() incorrectly counts result string length and may cause segfault) +--FILE-- + +--EXPECT-- +string(6) "bzexbz" +Done diff --git a/tests/std/strings/bug33605.phpt b/tests/std/strings/bug33605.phpt new file mode 100644 index 00000000..94b57b20 --- /dev/null +++ b/tests/std/strings/bug33605.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #33605 (substr_compare crashes) +--FILE-- +getMessage(); +} + +?> +--EXPECT-- +substr_compare(): Argument #4 ($length) must be greater than or equal to 0 diff --git a/tests/std/strings/bug34214.phpt b/tests/std/strings/bug34214.phpt new file mode 100644 index 00000000..dc2eb450 --- /dev/null +++ b/tests/std/strings/bug34214.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #34214 (base64_decode() does not properly ignore whitespace) +--FILE-- + +--EXPECT-- +foobar foobar diff --git a/tests/std/strings/bug35817.phpt b/tests/std/strings/bug35817.phpt new file mode 100644 index 00000000..e2a752c4 --- /dev/null +++ b/tests/std/strings/bug35817.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #35817 (unpack() does not decode odd number of hexadecimal values) +--FILE-- + +--EXPECT-- +array(1) { + [1]=> + string(3) "181" +} +array(1) { + [1]=> + string(2) "18" +} +array(1) { + [1]=> + string(1) "1" +} diff --git a/tests/std/strings/bug36148.phpt b/tests/std/strings/bug36148.phpt new file mode 100644 index 00000000..2e9a81c5 --- /dev/null +++ b/tests/std/strings/bug36148.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of the string) +--FILE-- + +--EXPECT-- +a: array(1) { + [1]=> + string(2) "a0" +} +aa: array(1) { + [1]=> + string(2) "aa" +} +aaa: array(1) { + [1]=> + string(4) "aaa0" +} +aaaa: array(1) { + [1]=> + string(4) "aaaa" +} diff --git a/tests/std/strings/bug36306.phpt b/tests/std/strings/bug36306.phpt new file mode 100644 index 00000000..3c522507 --- /dev/null +++ b/tests/std/strings/bug36306.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #36306 (crc32() 64bit) +--FILE-- + +--EXPECT-- +cbd056ba diff --git a/tests/std/strings/bug36392.phpt b/tests/std/strings/bug36392.phpt new file mode 100644 index 00000000..b98f7e62 --- /dev/null +++ b/tests/std/strings/bug36392.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #36392 (wrong number of decimal digits with %e specifier in sprintf) +--FILE-- + +--EXPECT-- +1.123457e+0 +1.1234567890e+0 +1e+0 +1.1e+0 +1.1e+0 diff --git a/tests/std/strings/bug36944.phpt b/tests/std/strings/bug36944.phpt new file mode 100644 index 00000000..d7756124 --- /dev/null +++ b/tests/std/strings/bug36944.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #36944 (strncmp & strncasecmp do not return false on negative string length) +--FILE-- +getMessage() . \PHP_EOL; +} +var_dump(strncmp("test ", "e", 10)); +var_dump(strncmp("test ", "e", 0)); + +try { + var_dump(strncasecmp("test ", "E", -1)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} +var_dump(strncasecmp("test ", "E", 10)); +var_dump(strncasecmp("test ", "E", 0)); + +?> +--EXPECTF-- +strncmp(): Argument #3 ($length) must be greater than or equal to 0 +int(%d) +int(0) +strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 +int(%d) +int(0) diff --git a/tests/std/strings/bug37244.phpt b/tests/std/strings/bug37244.phpt new file mode 100644 index 00000000..bd9628e8 --- /dev/null +++ b/tests/std/strings/bug37244.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #37244 (base64_decode violates RFC 3548) +--FILE-- + +--EXPECT-- +string(93) "Implementations MUST reject the encoding if it contains characters outside the base alphabet." +bool(false) +string(92) "Implemem][ÛœÈUTÕ™Z™XÝH[˜ÛÙ[™ÈYˆ]ÛÛZ[œÈÚ\˜XÝ\œÈÝ]ÚYHH˜\ÙH[X™] " diff --git a/tests/std/strings/bug37262.phpt b/tests/std/strings/bug37262.phpt new file mode 100644 index 00000000..92abb292 --- /dev/null +++ b/tests/std/strings/bug37262.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #37262 (var_export() does not escape \0 character) +--FILE-- + +--EXPECT-- +'foo' . "\0" . 'bar' diff --git a/tests/std/strings/bug38322.phpt b/tests/std/strings/bug38322.phpt new file mode 100644 index 00000000..88b4caf4 --- /dev/null +++ b/tests/std/strings/bug38322.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #38322 (reading past array in sscanf() leads to segfault/arbitrary code execution) +--FILE-- + +--EXPECT-- +int(1) +Done diff --git a/tests/std/strings/bug38770.phpt b/tests/std/strings/bug38770.phpt new file mode 100644 index 00000000..a349ebff --- /dev/null +++ b/tests/std/strings/bug38770.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #38770 (unpack() broken with longs on 64 bit machines) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Array +( + [1] => 4294937296 +) +Array +( + [1] => -30000 +) +Done diff --git a/tests/std/strings/bug39032.phpt b/tests/std/strings/bug39032.phpt new file mode 100644 index 00000000..80d19920 --- /dev/null +++ b/tests/std/strings/bug39032.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #39032 (strcspn() stops on null character) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(1) +int(1) +Done diff --git a/tests/std/strings/bug39350.phpt b/tests/std/strings/bug39350.phpt new file mode 100644 index 00000000..8cc51e95 --- /dev/null +++ b/tests/std/strings/bug39350.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #39350 (implode/join() crash on empty input strings) +--FILE-- + +--EXPECT-- +Done diff --git a/tests/std/strings/bug39621.phpt b/tests/std/strings/bug39621.phpt new file mode 100644 index 00000000..d6ba790d --- /dev/null +++ b/tests/std/strings/bug39621.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #39621 (str_replace() is not binary safe on strings with equal length) +--FILE-- + +--EXPECTF-- +string(13) "qxxx%0xxxxxxxx" +string(13) "qxxx%0xxxxxxxx" +string(8) "any text" +string(8) "any text" +Done diff --git a/tests/std/strings/bug39873.phpt b/tests/std/strings/bug39873.phpt new file mode 100644 index 00000000..f264f6bb --- /dev/null +++ b/tests/std/strings/bug39873.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #39873 (number_format() breaks with locale & decimal points) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1,234.56 diff --git a/tests/std/strings/bug40432.phpt b/tests/std/strings/bug40432.phpt new file mode 100644 index 00000000..6db2e94e --- /dev/null +++ b/tests/std/strings/bug40432.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #40432 (strip_tags() fails with greater than in attribute) +--FILE-- + all">this') . "\n"; +?> +--EXPECT-- +this diff --git a/tests/std/strings/bug40637.phpt b/tests/std/strings/bug40637.phpt new file mode 100644 index 00000000..3f6fc834 --- /dev/null +++ b/tests/std/strings/bug40637.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #40637 (strip_tags() does not handle single quotes correctly) +--FILE-- +Text'; +var_dump(strip_tags($html)); + +echo "Done\n"; +?> +--EXPECT-- +string(4) "Text" +Done diff --git a/tests/std/strings/bug40704.phpt b/tests/std/strings/bug40704.phpt new file mode 100644 index 00000000..b2f6cf89 --- /dev/null +++ b/tests/std/strings/bug40704.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #40704 (strip_tags() does not handle single quotes correctly) +--FILE-- +Bug ' Trigger Missing Text"; +var_dump(strip_tags($html)); + +echo "Done\n"; +?> +--EXPECT-- +string(26) "Bug ' Trigger Missing Text" +Done diff --git a/tests/std/strings/bug40754.phpt b/tests/std/strings/bug40754.phpt new file mode 100644 index 00000000..41032a94 --- /dev/null +++ b/tests/std/strings/bug40754.phpt @@ -0,0 +1,95 @@ +--TEST-- +Bug #40754 (Overflow checks inside string functions) +--FILE-- +getMessage() . "\n"; +} + +try { + substr_compare("abcde", "abc", $v, $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + stripos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + substr_count("abcde", "abc", $v, 1); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + substr_count("abcde", "abc", 1, $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strpos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + stripos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strrpos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strripos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strripos("abcde", "abc", $v); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +var_dump(strncmp("abcde", "abc", $v)); +var_dump(chunk_split("abcde", $v, "abc")); +var_dump(substr("abcde", $v, $v)); + +?> +--EXPECT-- +string(4) "bcde" +string(6) "abcdex" +int(0) +int(0) +substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +substr_compare(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +substr_count(): Argument #4 ($length) must be contained in argument #1 ($haystack) +strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +int(1) +string(8) "abcdeabc" +string(0) "" diff --git a/tests/std/strings/bug40915.phpt b/tests/std/strings/bug40915.phpt new file mode 100644 index 00000000..97597007 --- /dev/null +++ b/tests/std/strings/bug40915.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #40915 (addcslashes unexpected behavior with binary input) +--FILE-- + +--EXPECTF-- +string(4) "a\0z" +string(3) "a%0z" +string(7) "a\000\z" +string(4) "a%0\z" +Done diff --git a/tests/std/strings/bug42107.phpt b/tests/std/strings/bug42107.phpt new file mode 100644 index 00000000..f998f7d8 --- /dev/null +++ b/tests/std/strings/bug42107.phpt @@ -0,0 +1,51 @@ +--TEST-- +Bug #42107 (sscanf() broken when using %2$s type format parameters) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" +} +array(2) { + [0]=> + string(3) "two" + [1]=> + string(3) "one" +} +-- +string(3) "one" +string(3) "two" +string(3) "two" +string(3) "one" +-- +array(2) { + [0]=> + NULL + [1]=> + NULL +} +array(1) { + [0]=> + NULL +} +Done diff --git a/tests/std/strings/bug42208.phpt b/tests/std/strings/bug42208.phpt new file mode 100644 index 00000000..72488a93 --- /dev/null +++ b/tests/std/strings/bug42208.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #42208 (substr_replace() crashes when the same array is passed more than once) +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(2) "11" + [1]=> + string(2) "21" +} diff --git a/tests/std/strings/bug43927.phpt b/tests/std/strings/bug43927.phpt new file mode 100644 index 00000000..b780c4aa --- /dev/null +++ b/tests/std/strings/bug43927.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #43927 (koi8r is missing from html_entity_decode()) +--FILE-- + +--EXPECT-- +string(4) "<" +string(5) "&" +string(8) "&lt;" diff --git a/tests/std/strings/bug43957.phpt b/tests/std/strings/bug43957.phpt new file mode 100644 index 00000000..a9427f1d --- /dev/null +++ b/tests/std/strings/bug43957.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #43957 (utf8_decode() bogus conversion on multibyte indicator near end of string) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Deprecated: Function utf8_decode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +abc? diff --git a/tests/std/strings/bug44242.phpt b/tests/std/strings/bug44242.phpt new file mode 100644 index 00000000..00adda2b --- /dev/null +++ b/tests/std/strings/bug44242.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #44242 (metaphone('CMXFXM') crashes PHP) +--FILE-- + +--EXPECT-- +KMKSFKSS +KMKSFKSF +KMKSFKSSKSS diff --git a/tests/std/strings/bug44703.phpt b/tests/std/strings/bug44703.phpt new file mode 100644 index 00000000..a59cffef --- /dev/null +++ b/tests/std/strings/bug44703.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #44703 (htmlspecialchars() does not detect bad character set argument) +--SKIPIF-- + +--FILE-- +Test", ENT_COMPAT, 1)); +var_dump(htmlspecialchars("Test", ENT_COMPAT, 12)); +var_dump(htmlspecialchars("Test", ENT_COMPAT, 125)); +var_dump(htmlspecialchars("Test", ENT_COMPAT, 1252)); +var_dump(htmlspecialchars("Test", ENT_COMPAT, 12526)); + +var_dump(htmlspecialchars("<>", ENT_COMPAT, 866)); +var_dump(htmlspecialchars("<>", ENT_COMPAT, 8666)); + +var_dump(htmlspecialchars("<>", ENT_COMPAT, NULL)); + + +var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SJIS')); +var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SjiS')); + +var_dump(htmlspecialchars("<>", ENT_COMPAT, str_repeat('a', 100))); + +?> +--EXPECTF-- +Warning: htmlspecialchars(): Charset "1" is not supported, assuming UTF-8 in %s on line %d +string(35) "<a href='test'>Test</a>" + +Warning: htmlspecialchars(): Charset "12" is not supported, assuming UTF-8 in %s on line %d +string(35) "<a href='test'>Test</a>" + +Warning: htmlspecialchars(): Charset "125" is not supported, assuming UTF-8 in %s on line %d +string(35) "<a href='test'>Test</a>" +string(35) "<a href='test'>Test</a>" + +Warning: htmlspecialchars(): Charset "12526" is not supported, assuming UTF-8 in %s on line %d +string(35) "<a href='test'>Test</a>" +string(8) "<>" + +Warning: htmlspecialchars(): Charset "8666" is not supported, assuming UTF-8 in %s on line %d +string(8) "<>" +string(8) "<>" +string(8) "<>" +string(8) "<>" + +Warning: htmlspecialchars(): Charset "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is not supported, assuming UTF-8 in %s on line %d +string(8) "<>" diff --git a/tests/std/strings/bug45166.phpt b/tests/std/strings/bug45166.phpt new file mode 100644 index 00000000..2ed07b62 --- /dev/null +++ b/tests/std/strings/bug45166.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #45166 (substr() ) +--FILE-- + +--EXPECT-- +cd diff --git a/tests/std/strings/bug45485.phpt b/tests/std/strings/bug45485.phpt new file mode 100644 index 00000000..4d24c9ad --- /dev/null +++ b/tests/std/strings/bug45485.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #45485 (strip_tags and This Text disappears +EOD; + +$s = strip_tags($s); +echo htmlspecialchars($s),"\n"; + +$s =<<< EOD +This text is shown This Text disappears +EOD; + +$s = strip_tags($s); +echo htmlspecialchars($s),"\n"; + +?> +--EXPECT-- +This text is shown This Text disappears +This text is shown This Text disappears diff --git a/tests/std/strings/bug46578.phpt b/tests/std/strings/bug46578.phpt new file mode 100644 index 00000000..e07e9285 --- /dev/null +++ b/tests/std/strings/bug46578.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a single quote) +--FILE-- +foobar')); + +var_dump(strip_tags('foobar')); + +var_dump(strip_tags('foo */ ?>bar')); + +var_dump(strip_tags('< ax')); + +var_dump(strip_tags('')); + +var_dump(strip_tags(' +--EXPECT-- +string(6) "foobar" +string(6) "foobar" +string(6) "foobar" +string(4) "< ax" +string(0) "" +string(0) "" diff --git a/tests/std/strings/bug47168.phpt b/tests/std/strings/bug47168.phpt new file mode 100644 index 00000000..8d0886b8 --- /dev/null +++ b/tests/std/strings/bug47168.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #47168 (printf of floating point variable prints maximum of 40 decimal places) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0.00000000000045474735088646411895751953125 +int(44) diff --git a/tests/std/strings/bug47322.phpt b/tests/std/strings/bug47322.phpt new file mode 100644 index 00000000..6316c806 --- /dev/null +++ b/tests/std/strings/bug47322.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #47322 (sscanf %d doesn't work) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +[:59:58][][] +[15][1][58.2] +[15.1111][1][58.2] diff --git a/tests/std/strings/bug47443.phpt b/tests/std/strings/bug47443.phpt new file mode 100644 index 00000000..e673e807 --- /dev/null +++ b/tests/std/strings/bug47443.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #47443 (metaphone('scratch') returns wrong result) +--FILE-- + +--EXPECT-- +string(4) "SKRX" +string(4) "SKR0" +string(5) "SKRTK" diff --git a/tests/std/strings/bug47481.phpt b/tests/std/strings/bug47481.phpt new file mode 100644 index 00000000..f25ceae3 --- /dev/null +++ b/tests/std/strings/bug47481.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #47481 (natcasesort() does not sort extended ASCII characters correctly) +--FILE-- + +--EXPECT-- +-- Before sorting: -- +array(6) { + [0]=> + string(6) "Süden" + [1]=> + string(7) "spielen" + [2]=> + string(5) "Sonne" + [3]=> + string(4) "Wind" + [4]=> + string(5) "Regen" + [5]=> + string(4) "Meer" +} + +-- After Sorting: -- +bool(true) +array(6) { + [5]=> + string(4) "Meer" + [4]=> + string(5) "Regen" + [2]=> + string(5) "Sonne" + [1]=> + string(7) "spielen" + [0]=> + string(6) "Süden" + [3]=> + string(4) "Wind" +} +Done diff --git a/tests/std/strings/bug47842.phpt b/tests/std/strings/bug47842.phpt new file mode 100644 index 00000000..15db74a9 --- /dev/null +++ b/tests/std/strings/bug47842.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #47842 sscanf() does not support 64-bit values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +-Test +sscanf 32-bit signed int '2147483647' (2^31)-1 = 2147483647 +sscanf 32-bit unsign int '4294967295' (2^32)-1 = 4294967295 +sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807 +sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615 +printf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807 + +Warning: The float 1.8446744073709552E+19 is not representable as an int, cast occurred in %s on line %d +printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0 +Done diff --git a/tests/std/strings/bug48709.phpt b/tests/std/strings/bug48709.phpt new file mode 100644 index 00000000..9e0789a6 --- /dev/null +++ b/tests/std/strings/bug48709.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #48709 (metaphone and 'wh') +--FILE-- + %s\n", $letter, metaphone($letter)); +} + +?> +--EXPECT-- +kn => N +gn => N +pn => N +ae => E +wr => R +x => S +wh => W +wa => W diff --git a/tests/std/strings/bug49687.phpt b/tests/std/strings/bug49687.phpt new file mode 100644 index 00000000..858fc3b3 --- /dev/null +++ b/tests/std/strings/bug49687.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #49687 Several utf8_decode deficiencies and vulnerabilities +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Deprecated: Function utf8_decode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +413f3e42 + +Deprecated: Function utf8_decode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +3f22 + +Deprecated: Function utf8_decode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +413f3f423f433f3f +Done. diff --git a/tests/std/strings/bug49785.phpt b/tests/std/strings/bug49785.phpt new file mode 100644 index 00000000..e9416929 --- /dev/null +++ b/tests/std/strings/bug49785.phpt @@ -0,0 +1,4139 @@ +--TEST-- +Bug #49785 (insufficient input string validation of htmlspecialchars()) +--SKIPIF-- + +--FILE-- += 0x80\n"; +var_dump(_bin2hex(htmlspecialchars("\x80", ENT_QUOTES, 'Shift_JIS'))); +foreach (array_map('chr', range(0xa0, 0xdf)) as $c) { + var_dump(_bin2hex(htmlspecialchars($c, ENT_QUOTES, 'Shift_JIS'))); +} +var_dump(_bin2hex(htmlspecialchars("\xfd", ENT_QUOTES, 'Shift_JIS'))); +var_dump(_bin2hex(htmlspecialchars("\xfe", ENT_QUOTES, 'Shift_JIS'))); +var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'Shift_JIS'))); + +echo "--\n"; +echo "Shift_JIS: incomplete / invalid multibyte sequences\n"; +foreach (array_map('chr', array_merge(range(0x81, 0x9f), range(0xe0, 0xfc))) as $c) { + var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\x3f", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\x40", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\x7e", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\x7f", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\xfc", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\xfd", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'Shift_JIS'))); + var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'Shift_JIS'))); +} + +echo "--\n"; +echo "EUC-JP: non-lead byte >= 0x80\n"; +foreach (array_map('chr', array_merge(range(0x80, 0x8d), range(0x90, 0x9f))) as $c) { + var_dump(_bin2hex(htmlspecialchars($c, ENT_QUOTES, 'EUC-JP'))); +} +var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'EUC-JP'))); + +// EUC-JP: control codes that are virtually lead bytes +var_dump(_bin2hex(htmlspecialchars("\x8e", ENT_QUOTES, 'EUC-JP'))); +var_dump(_bin2hex(htmlspecialchars("\x8f", ENT_QUOTES, 'EUC-JP'))); +var_dump(_bin2hex(htmlspecialchars("\x8e\xa1", ENT_QUOTES, 'EUC-JP'))); +var_dump(_bin2hex(htmlspecialchars("\x8f\xa1", ENT_QUOTES, 'EUC-JP'))); +var_dump(_bin2hex(htmlspecialchars("\x8e\xa1\xa3", ENT_QUOTES, 'EUC-JP'))); +var_dump(_bin2hex(htmlspecialchars("\x8f\xa1\xa3", ENT_QUOTES, 'EUC-JP'))); + +echo "--\n"; +echo "EUC-JP: incomplete / invalid multibyte sequences\n"; +foreach (array_map('chr', array_merge(range(0xa1, 0xfe))) as $c) { + var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\x26", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\xa0", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\xa1", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\x26", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\x80", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\xa0", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\xa1", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\xfe", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8e$c\xff", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\x26", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\x80", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\xa0", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\xa1", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\xfe", ENT_QUOTES, 'EUC-JP'))); + var_dump(_bin2hex(htmlspecialchars("\x8f$c\xff", ENT_QUOTES, 'EUC-JP'))); +} + +echo "--\n"; +echo "BIG5: non-lead byte >= 0x80\n"; +var_dump(_bin2hex(htmlspecialchars("\x80", ENT_QUOTES, 'BIG5'))); +var_dump(_bin2hex(htmlspecialchars("\xff", ENT_QUOTES, 'BIG5'))); + +echo "--\n"; +echo "BIG5: incomplete / invalid multibyte sequences\n"; +foreach (array_map('chr', range(0x81, 0xfe)) as $c) { + var_dump(_bin2hex(htmlspecialchars("$c", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\x3f", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\x40", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\x7e", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\x7f", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\x80", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\xa0", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\xa1", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\xfe", ENT_QUOTES, 'BIG5'))); + var_dump(_bin2hex(htmlspecialchars("$c\xff", ENT_QUOTES, 'BIG5'))); +} +?> +--EXPECT-- +UTF-8: basic tests +string(0) "" +string(4) "c280" +string(0) "" +string(0) "" +string(14) "26416c7068613b" +string(14) "26616c7068613b" +string(4) "dfbf" +string(6) "e0a080" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(16) "266865617274733b" +string(6) "efbfbf" +string(0) "" +string(0) "" +string(0) "" +string(8) "f0908080" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- +UTF-8: with ENT_IGNORE +string(4) "c280" +string(6) "e0a080" +string(8) "f0908080" +-- +UTF-8: alternative (invalid) UTF-8 sequence / surrogate pairs +string(0) "" +string(0) "" +string(0) "" +string(6) "ecbfbf" +string(0) "" +string(0) "" +string(6) "ee8080" +-- +Shift_JIS: non-lead byte >= 0x80 +string(0) "" +string(0) "" +string(2) "a1" +string(2) "a2" +string(2) "a3" +string(2) "a4" +string(2) "a5" +string(2) "a6" +string(2) "a7" +string(2) "a8" +string(2) "a9" +string(2) "aa" +string(2) "ab" +string(2) "ac" +string(2) "ad" +string(2) "ae" +string(2) "af" +string(2) "b0" +string(2) "b1" +string(2) "b2" +string(2) "b3" +string(2) "b4" +string(2) "b5" +string(2) "b6" +string(2) "b7" +string(2) "b8" +string(2) "b9" +string(2) "ba" +string(2) "bb" +string(2) "bc" +string(2) "bd" +string(2) "be" +string(2) "bf" +string(2) "c0" +string(2) "c1" +string(2) "c2" +string(2) "c3" +string(2) "c4" +string(2) "c5" +string(2) "c6" +string(2) "c7" +string(2) "c8" +string(2) "c9" +string(2) "ca" +string(2) "cb" +string(2) "cc" +string(2) "cd" +string(2) "ce" +string(2) "cf" +string(2) "d0" +string(2) "d1" +string(2) "d2" +string(2) "d3" +string(2) "d4" +string(2) "d5" +string(2) "d6" +string(2) "d7" +string(2) "d8" +string(2) "d9" +string(2) "da" +string(2) "db" +string(2) "dc" +string(2) "dd" +string(2) "de" +string(2) "df" +string(0) "" +string(0) "" +string(0) "" +-- +Shift_JIS: incomplete / invalid multibyte sequences +string(0) "" +string(0) "" +string(4) "8140" +string(4) "817e" +string(0) "" +string(4) "8180" +string(4) "81fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8240" +string(4) "827e" +string(0) "" +string(4) "8280" +string(4) "82fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8340" +string(4) "837e" +string(0) "" +string(4) "8380" +string(4) "83fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8440" +string(4) "847e" +string(0) "" +string(4) "8480" +string(4) "84fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8540" +string(4) "857e" +string(0) "" +string(4) "8580" +string(4) "85fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8640" +string(4) "867e" +string(0) "" +string(4) "8680" +string(4) "86fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8740" +string(4) "877e" +string(0) "" +string(4) "8780" +string(4) "87fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8840" +string(4) "887e" +string(0) "" +string(4) "8880" +string(4) "88fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8940" +string(4) "897e" +string(0) "" +string(4) "8980" +string(4) "89fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8a40" +string(4) "8a7e" +string(0) "" +string(4) "8a80" +string(4) "8afc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8b40" +string(4) "8b7e" +string(0) "" +string(4) "8b80" +string(4) "8bfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8c40" +string(4) "8c7e" +string(0) "" +string(4) "8c80" +string(4) "8cfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8d40" +string(4) "8d7e" +string(0) "" +string(4) "8d80" +string(4) "8dfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8e40" +string(4) "8e7e" +string(0) "" +string(4) "8e80" +string(4) "8efc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "8f40" +string(4) "8f7e" +string(0) "" +string(4) "8f80" +string(4) "8ffc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9040" +string(4) "907e" +string(0) "" +string(4) "9080" +string(4) "90fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9140" +string(4) "917e" +string(0) "" +string(4) "9180" +string(4) "91fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9240" +string(4) "927e" +string(0) "" +string(4) "9280" +string(4) "92fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9340" +string(4) "937e" +string(0) "" +string(4) "9380" +string(4) "93fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9440" +string(4) "947e" +string(0) "" +string(4) "9480" +string(4) "94fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9540" +string(4) "957e" +string(0) "" +string(4) "9580" +string(4) "95fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9640" +string(4) "967e" +string(0) "" +string(4) "9680" +string(4) "96fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9740" +string(4) "977e" +string(0) "" +string(4) "9780" +string(4) "97fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9840" +string(4) "987e" +string(0) "" +string(4) "9880" +string(4) "98fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9940" +string(4) "997e" +string(0) "" +string(4) "9980" +string(4) "99fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9a40" +string(4) "9a7e" +string(0) "" +string(4) "9a80" +string(4) "9afc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9b40" +string(4) "9b7e" +string(0) "" +string(4) "9b80" +string(4) "9bfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9c40" +string(4) "9c7e" +string(0) "" +string(4) "9c80" +string(4) "9cfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9d40" +string(4) "9d7e" +string(0) "" +string(4) "9d80" +string(4) "9dfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9e40" +string(4) "9e7e" +string(0) "" +string(4) "9e80" +string(4) "9efc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "9f40" +string(4) "9f7e" +string(0) "" +string(4) "9f80" +string(4) "9ffc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e040" +string(4) "e07e" +string(0) "" +string(4) "e080" +string(4) "e0fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e140" +string(4) "e17e" +string(0) "" +string(4) "e180" +string(4) "e1fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e240" +string(4) "e27e" +string(0) "" +string(4) "e280" +string(4) "e2fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e340" +string(4) "e37e" +string(0) "" +string(4) "e380" +string(4) "e3fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e440" +string(4) "e47e" +string(0) "" +string(4) "e480" +string(4) "e4fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e540" +string(4) "e57e" +string(0) "" +string(4) "e580" +string(4) "e5fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e640" +string(4) "e67e" +string(0) "" +string(4) "e680" +string(4) "e6fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e740" +string(4) "e77e" +string(0) "" +string(4) "e780" +string(4) "e7fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e840" +string(4) "e87e" +string(0) "" +string(4) "e880" +string(4) "e8fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e940" +string(4) "e97e" +string(0) "" +string(4) "e980" +string(4) "e9fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ea40" +string(4) "ea7e" +string(0) "" +string(4) "ea80" +string(4) "eafc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eb40" +string(4) "eb7e" +string(0) "" +string(4) "eb80" +string(4) "ebfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ec40" +string(4) "ec7e" +string(0) "" +string(4) "ec80" +string(4) "ecfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ed40" +string(4) "ed7e" +string(0) "" +string(4) "ed80" +string(4) "edfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ee40" +string(4) "ee7e" +string(0) "" +string(4) "ee80" +string(4) "eefc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ef40" +string(4) "ef7e" +string(0) "" +string(4) "ef80" +string(4) "effc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f040" +string(4) "f07e" +string(0) "" +string(4) "f080" +string(4) "f0fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f140" +string(4) "f17e" +string(0) "" +string(4) "f180" +string(4) "f1fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f240" +string(4) "f27e" +string(0) "" +string(4) "f280" +string(4) "f2fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f340" +string(4) "f37e" +string(0) "" +string(4) "f380" +string(4) "f3fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f440" +string(4) "f47e" +string(0) "" +string(4) "f480" +string(4) "f4fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f540" +string(4) "f57e" +string(0) "" +string(4) "f580" +string(4) "f5fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f640" +string(4) "f67e" +string(0) "" +string(4) "f680" +string(4) "f6fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f740" +string(4) "f77e" +string(0) "" +string(4) "f780" +string(4) "f7fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f840" +string(4) "f87e" +string(0) "" +string(4) "f880" +string(4) "f8fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f940" +string(4) "f97e" +string(0) "" +string(4) "f980" +string(4) "f9fc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fa40" +string(4) "fa7e" +string(0) "" +string(4) "fa80" +string(4) "fafc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fb40" +string(4) "fb7e" +string(0) "" +string(4) "fb80" +string(4) "fbfc" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fc40" +string(4) "fc7e" +string(0) "" +string(4) "fc80" +string(4) "fcfc" +string(0) "" +string(0) "" +string(0) "" +-- +EUC-JP: non-lead byte >= 0x80 +string(2) "80" +string(2) "81" +string(2) "82" +string(2) "83" +string(2) "84" +string(2) "85" +string(2) "86" +string(2) "87" +string(2) "88" +string(2) "89" +string(2) "8a" +string(2) "8b" +string(2) "8c" +string(2) "8d" +string(2) "90" +string(2) "91" +string(2) "92" +string(2) "93" +string(2) "94" +string(2) "95" +string(2) "96" +string(2) "97" +string(2) "98" +string(2) "99" +string(2) "9a" +string(2) "9b" +string(2) "9c" +string(2) "9d" +string(2) "9e" +string(2) "9f" +string(0) "" +string(0) "" +string(0) "" +string(4) "8ea1" +string(0) "" +string(0) "" +string(6) "8fa1a3" +-- +EUC-JP: incomplete / invalid multibyte sequences +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a1a1" +string(4) "a1fe" +string(0) "" +string(4) "8ea1" +string(14) "8ea126616d703b" +string(6) "8ea180" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa1a1" +string(6) "8fa1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a2a1" +string(4) "a2fe" +string(0) "" +string(4) "8ea2" +string(14) "8ea226616d703b" +string(6) "8ea280" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa2a1" +string(6) "8fa2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a3a1" +string(4) "a3fe" +string(0) "" +string(4) "8ea3" +string(14) "8ea326616d703b" +string(6) "8ea380" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa3a1" +string(6) "8fa3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a4a1" +string(4) "a4fe" +string(0) "" +string(4) "8ea4" +string(14) "8ea426616d703b" +string(6) "8ea480" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa4a1" +string(6) "8fa4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a5a1" +string(4) "a5fe" +string(0) "" +string(4) "8ea5" +string(14) "8ea526616d703b" +string(6) "8ea580" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa5a1" +string(6) "8fa5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a6a1" +string(4) "a6fe" +string(0) "" +string(4) "8ea6" +string(14) "8ea626616d703b" +string(6) "8ea680" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa6a1" +string(6) "8fa6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a7a1" +string(4) "a7fe" +string(0) "" +string(4) "8ea7" +string(14) "8ea726616d703b" +string(6) "8ea780" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa7a1" +string(6) "8fa7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a8a1" +string(4) "a8fe" +string(0) "" +string(4) "8ea8" +string(14) "8ea826616d703b" +string(6) "8ea880" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa8a1" +string(6) "8fa8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "a9a1" +string(4) "a9fe" +string(0) "" +string(4) "8ea9" +string(14) "8ea926616d703b" +string(6) "8ea980" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fa9a1" +string(6) "8fa9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "aaa1" +string(4) "aafe" +string(0) "" +string(4) "8eaa" +string(14) "8eaa26616d703b" +string(6) "8eaa80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8faaa1" +string(6) "8faafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "aba1" +string(4) "abfe" +string(0) "" +string(4) "8eab" +string(14) "8eab26616d703b" +string(6) "8eab80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8faba1" +string(6) "8fabfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "aca1" +string(4) "acfe" +string(0) "" +string(4) "8eac" +string(14) "8eac26616d703b" +string(6) "8eac80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8faca1" +string(6) "8facfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "ada1" +string(4) "adfe" +string(0) "" +string(4) "8ead" +string(14) "8ead26616d703b" +string(6) "8ead80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fada1" +string(6) "8fadfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "aea1" +string(4) "aefe" +string(0) "" +string(4) "8eae" +string(14) "8eae26616d703b" +string(6) "8eae80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8faea1" +string(6) "8faefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "afa1" +string(4) "affe" +string(0) "" +string(4) "8eaf" +string(14) "8eaf26616d703b" +string(6) "8eaf80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fafa1" +string(6) "8faffe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b0a1" +string(4) "b0fe" +string(0) "" +string(4) "8eb0" +string(14) "8eb026616d703b" +string(6) "8eb080" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb0a1" +string(6) "8fb0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b1a1" +string(4) "b1fe" +string(0) "" +string(4) "8eb1" +string(14) "8eb126616d703b" +string(6) "8eb180" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb1a1" +string(6) "8fb1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b2a1" +string(4) "b2fe" +string(0) "" +string(4) "8eb2" +string(14) "8eb226616d703b" +string(6) "8eb280" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb2a1" +string(6) "8fb2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b3a1" +string(4) "b3fe" +string(0) "" +string(4) "8eb3" +string(14) "8eb326616d703b" +string(6) "8eb380" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb3a1" +string(6) "8fb3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b4a1" +string(4) "b4fe" +string(0) "" +string(4) "8eb4" +string(14) "8eb426616d703b" +string(6) "8eb480" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb4a1" +string(6) "8fb4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b5a1" +string(4) "b5fe" +string(0) "" +string(4) "8eb5" +string(14) "8eb526616d703b" +string(6) "8eb580" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb5a1" +string(6) "8fb5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b6a1" +string(4) "b6fe" +string(0) "" +string(4) "8eb6" +string(14) "8eb626616d703b" +string(6) "8eb680" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb6a1" +string(6) "8fb6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b7a1" +string(4) "b7fe" +string(0) "" +string(4) "8eb7" +string(14) "8eb726616d703b" +string(6) "8eb780" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb7a1" +string(6) "8fb7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b8a1" +string(4) "b8fe" +string(0) "" +string(4) "8eb8" +string(14) "8eb826616d703b" +string(6) "8eb880" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb8a1" +string(6) "8fb8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "b9a1" +string(4) "b9fe" +string(0) "" +string(4) "8eb9" +string(14) "8eb926616d703b" +string(6) "8eb980" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fb9a1" +string(6) "8fb9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "baa1" +string(4) "bafe" +string(0) "" +string(4) "8eba" +string(14) "8eba26616d703b" +string(6) "8eba80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbaa1" +string(6) "8fbafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "bba1" +string(4) "bbfe" +string(0) "" +string(4) "8ebb" +string(14) "8ebb26616d703b" +string(6) "8ebb80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbba1" +string(6) "8fbbfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "bca1" +string(4) "bcfe" +string(0) "" +string(4) "8ebc" +string(14) "8ebc26616d703b" +string(6) "8ebc80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbca1" +string(6) "8fbcfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "bda1" +string(4) "bdfe" +string(0) "" +string(4) "8ebd" +string(14) "8ebd26616d703b" +string(6) "8ebd80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbda1" +string(6) "8fbdfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "bea1" +string(4) "befe" +string(0) "" +string(4) "8ebe" +string(14) "8ebe26616d703b" +string(6) "8ebe80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbea1" +string(6) "8fbefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "bfa1" +string(4) "bffe" +string(0) "" +string(4) "8ebf" +string(14) "8ebf26616d703b" +string(6) "8ebf80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fbfa1" +string(6) "8fbffe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c0a1" +string(4) "c0fe" +string(0) "" +string(4) "8ec0" +string(14) "8ec026616d703b" +string(6) "8ec080" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc0a1" +string(6) "8fc0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c1a1" +string(4) "c1fe" +string(0) "" +string(4) "8ec1" +string(14) "8ec126616d703b" +string(6) "8ec180" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc1a1" +string(6) "8fc1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c2a1" +string(4) "c2fe" +string(0) "" +string(4) "8ec2" +string(14) "8ec226616d703b" +string(6) "8ec280" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc2a1" +string(6) "8fc2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c3a1" +string(4) "c3fe" +string(0) "" +string(4) "8ec3" +string(14) "8ec326616d703b" +string(6) "8ec380" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc3a1" +string(6) "8fc3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c4a1" +string(4) "c4fe" +string(0) "" +string(4) "8ec4" +string(14) "8ec426616d703b" +string(6) "8ec480" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc4a1" +string(6) "8fc4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c5a1" +string(4) "c5fe" +string(0) "" +string(4) "8ec5" +string(14) "8ec526616d703b" +string(6) "8ec580" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc5a1" +string(6) "8fc5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c6a1" +string(4) "c6fe" +string(0) "" +string(4) "8ec6" +string(14) "8ec626616d703b" +string(6) "8ec680" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc6a1" +string(6) "8fc6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c7a1" +string(4) "c7fe" +string(0) "" +string(4) "8ec7" +string(14) "8ec726616d703b" +string(6) "8ec780" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc7a1" +string(6) "8fc7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c8a1" +string(4) "c8fe" +string(0) "" +string(4) "8ec8" +string(14) "8ec826616d703b" +string(6) "8ec880" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc8a1" +string(6) "8fc8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c9a1" +string(4) "c9fe" +string(0) "" +string(4) "8ec9" +string(14) "8ec926616d703b" +string(6) "8ec980" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fc9a1" +string(6) "8fc9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "caa1" +string(4) "cafe" +string(0) "" +string(4) "8eca" +string(14) "8eca26616d703b" +string(6) "8eca80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcaa1" +string(6) "8fcafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "cba1" +string(4) "cbfe" +string(0) "" +string(4) "8ecb" +string(14) "8ecb26616d703b" +string(6) "8ecb80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcba1" +string(6) "8fcbfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "cca1" +string(4) "ccfe" +string(0) "" +string(4) "8ecc" +string(14) "8ecc26616d703b" +string(6) "8ecc80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcca1" +string(6) "8fccfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "cda1" +string(4) "cdfe" +string(0) "" +string(4) "8ecd" +string(14) "8ecd26616d703b" +string(6) "8ecd80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcda1" +string(6) "8fcdfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "cea1" +string(4) "cefe" +string(0) "" +string(4) "8ece" +string(14) "8ece26616d703b" +string(6) "8ece80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcea1" +string(6) "8fcefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "cfa1" +string(4) "cffe" +string(0) "" +string(4) "8ecf" +string(14) "8ecf26616d703b" +string(6) "8ecf80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fcfa1" +string(6) "8fcffe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d0a1" +string(4) "d0fe" +string(0) "" +string(4) "8ed0" +string(14) "8ed026616d703b" +string(6) "8ed080" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd0a1" +string(6) "8fd0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d1a1" +string(4) "d1fe" +string(0) "" +string(4) "8ed1" +string(14) "8ed126616d703b" +string(6) "8ed180" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd1a1" +string(6) "8fd1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d2a1" +string(4) "d2fe" +string(0) "" +string(4) "8ed2" +string(14) "8ed226616d703b" +string(6) "8ed280" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd2a1" +string(6) "8fd2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d3a1" +string(4) "d3fe" +string(0) "" +string(4) "8ed3" +string(14) "8ed326616d703b" +string(6) "8ed380" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd3a1" +string(6) "8fd3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d4a1" +string(4) "d4fe" +string(0) "" +string(4) "8ed4" +string(14) "8ed426616d703b" +string(6) "8ed480" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd4a1" +string(6) "8fd4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d5a1" +string(4) "d5fe" +string(0) "" +string(4) "8ed5" +string(14) "8ed526616d703b" +string(6) "8ed580" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd5a1" +string(6) "8fd5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d6a1" +string(4) "d6fe" +string(0) "" +string(4) "8ed6" +string(14) "8ed626616d703b" +string(6) "8ed680" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd6a1" +string(6) "8fd6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d7a1" +string(4) "d7fe" +string(0) "" +string(4) "8ed7" +string(14) "8ed726616d703b" +string(6) "8ed780" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd7a1" +string(6) "8fd7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d8a1" +string(4) "d8fe" +string(0) "" +string(4) "8ed8" +string(14) "8ed826616d703b" +string(6) "8ed880" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd8a1" +string(6) "8fd8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "d9a1" +string(4) "d9fe" +string(0) "" +string(4) "8ed9" +string(14) "8ed926616d703b" +string(6) "8ed980" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fd9a1" +string(6) "8fd9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "daa1" +string(4) "dafe" +string(0) "" +string(4) "8eda" +string(14) "8eda26616d703b" +string(6) "8eda80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdaa1" +string(6) "8fdafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "dba1" +string(4) "dbfe" +string(0) "" +string(4) "8edb" +string(14) "8edb26616d703b" +string(6) "8edb80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdba1" +string(6) "8fdbfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "dca1" +string(4) "dcfe" +string(0) "" +string(4) "8edc" +string(14) "8edc26616d703b" +string(6) "8edc80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdca1" +string(6) "8fdcfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "dda1" +string(4) "ddfe" +string(0) "" +string(4) "8edd" +string(14) "8edd26616d703b" +string(6) "8edd80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdda1" +string(6) "8fddfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "dea1" +string(4) "defe" +string(0) "" +string(4) "8ede" +string(14) "8ede26616d703b" +string(6) "8ede80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdea1" +string(6) "8fdefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "dfa1" +string(4) "dffe" +string(0) "" +string(4) "8edf" +string(14) "8edf26616d703b" +string(6) "8edf80" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fdfa1" +string(6) "8fdffe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e0a1" +string(4) "e0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe0a1" +string(6) "8fe0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e1a1" +string(4) "e1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe1a1" +string(6) "8fe1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e2a1" +string(4) "e2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe2a1" +string(6) "8fe2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e3a1" +string(4) "e3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe3a1" +string(6) "8fe3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e4a1" +string(4) "e4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe4a1" +string(6) "8fe4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e5a1" +string(4) "e5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe5a1" +string(6) "8fe5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e6a1" +string(4) "e6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe6a1" +string(6) "8fe6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e7a1" +string(4) "e7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe7a1" +string(6) "8fe7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e8a1" +string(4) "e8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe8a1" +string(6) "8fe8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "e9a1" +string(4) "e9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fe9a1" +string(6) "8fe9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eaa1" +string(4) "eafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8feaa1" +string(6) "8feafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eba1" +string(4) "ebfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8feba1" +string(6) "8febfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eca1" +string(4) "ecfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8feca1" +string(6) "8fecfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eda1" +string(4) "edfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8feda1" +string(6) "8fedfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "eea1" +string(4) "eefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8feea1" +string(6) "8feefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "efa1" +string(4) "effe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8fefa1" +string(6) "8feffe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f0a1" +string(4) "f0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff0a1" +string(6) "8ff0fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f1a1" +string(4) "f1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff1a1" +string(6) "8ff1fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f2a1" +string(4) "f2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff2a1" +string(6) "8ff2fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f3a1" +string(4) "f3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff3a1" +string(6) "8ff3fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f4a1" +string(4) "f4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff4a1" +string(6) "8ff4fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f5a1" +string(4) "f5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff5a1" +string(6) "8ff5fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f6a1" +string(4) "f6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff6a1" +string(6) "8ff6fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f7a1" +string(4) "f7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff7a1" +string(6) "8ff7fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f8a1" +string(4) "f8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff8a1" +string(6) "8ff8fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "f9a1" +string(4) "f9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ff9a1" +string(6) "8ff9fe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "faa1" +string(4) "fafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ffaa1" +string(6) "8ffafe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fba1" +string(4) "fbfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ffba1" +string(6) "8ffbfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fca1" +string(4) "fcfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ffca1" +string(6) "8ffcfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fda1" +string(4) "fdfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ffda1" +string(6) "8ffdfe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "fea1" +string(4) "fefe" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(6) "8ffea1" +string(6) "8ffefe" +string(0) "" +-- +BIG5: non-lead byte >= 0x80 +string(2) "80" +string(2) "ff" +-- +BIG5: incomplete / invalid multibyte sequences +string(0) "" +string(0) "" +string(4) "8140" +string(4) "817e" +string(0) "" +string(0) "" +string(0) "" +string(4) "81a1" +string(4) "81fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8240" +string(4) "827e" +string(0) "" +string(0) "" +string(0) "" +string(4) "82a1" +string(4) "82fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8340" +string(4) "837e" +string(0) "" +string(0) "" +string(0) "" +string(4) "83a1" +string(4) "83fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8440" +string(4) "847e" +string(0) "" +string(0) "" +string(0) "" +string(4) "84a1" +string(4) "84fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8540" +string(4) "857e" +string(0) "" +string(0) "" +string(0) "" +string(4) "85a1" +string(4) "85fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8640" +string(4) "867e" +string(0) "" +string(0) "" +string(0) "" +string(4) "86a1" +string(4) "86fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8740" +string(4) "877e" +string(0) "" +string(0) "" +string(0) "" +string(4) "87a1" +string(4) "87fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8840" +string(4) "887e" +string(0) "" +string(0) "" +string(0) "" +string(4) "88a1" +string(4) "88fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8940" +string(4) "897e" +string(0) "" +string(0) "" +string(0) "" +string(4) "89a1" +string(4) "89fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8a40" +string(4) "8a7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8aa1" +string(4) "8afe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8b40" +string(4) "8b7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8ba1" +string(4) "8bfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8c40" +string(4) "8c7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8ca1" +string(4) "8cfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8d40" +string(4) "8d7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8da1" +string(4) "8dfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8e40" +string(4) "8e7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8ea1" +string(4) "8efe" +string(0) "" +string(0) "" +string(0) "" +string(4) "8f40" +string(4) "8f7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "8fa1" +string(4) "8ffe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9040" +string(4) "907e" +string(0) "" +string(0) "" +string(0) "" +string(4) "90a1" +string(4) "90fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9140" +string(4) "917e" +string(0) "" +string(0) "" +string(0) "" +string(4) "91a1" +string(4) "91fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9240" +string(4) "927e" +string(0) "" +string(0) "" +string(0) "" +string(4) "92a1" +string(4) "92fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9340" +string(4) "937e" +string(0) "" +string(0) "" +string(0) "" +string(4) "93a1" +string(4) "93fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9440" +string(4) "947e" +string(0) "" +string(0) "" +string(0) "" +string(4) "94a1" +string(4) "94fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9540" +string(4) "957e" +string(0) "" +string(0) "" +string(0) "" +string(4) "95a1" +string(4) "95fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9640" +string(4) "967e" +string(0) "" +string(0) "" +string(0) "" +string(4) "96a1" +string(4) "96fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9740" +string(4) "977e" +string(0) "" +string(0) "" +string(0) "" +string(4) "97a1" +string(4) "97fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9840" +string(4) "987e" +string(0) "" +string(0) "" +string(0) "" +string(4) "98a1" +string(4) "98fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9940" +string(4) "997e" +string(0) "" +string(0) "" +string(0) "" +string(4) "99a1" +string(4) "99fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9a40" +string(4) "9a7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9aa1" +string(4) "9afe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9b40" +string(4) "9b7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9ba1" +string(4) "9bfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9c40" +string(4) "9c7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9ca1" +string(4) "9cfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9d40" +string(4) "9d7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9da1" +string(4) "9dfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9e40" +string(4) "9e7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9ea1" +string(4) "9efe" +string(0) "" +string(0) "" +string(0) "" +string(4) "9f40" +string(4) "9f7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "9fa1" +string(4) "9ffe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a040" +string(4) "a07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a0a1" +string(4) "a0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a140" +string(4) "a17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a1a1" +string(4) "a1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a240" +string(4) "a27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a2a1" +string(4) "a2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a340" +string(4) "a37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a3a1" +string(4) "a3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a440" +string(4) "a47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a4a1" +string(4) "a4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a540" +string(4) "a57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a5a1" +string(4) "a5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a640" +string(4) "a67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a6a1" +string(4) "a6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a740" +string(4) "a77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a7a1" +string(4) "a7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a840" +string(4) "a87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a8a1" +string(4) "a8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "a940" +string(4) "a97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "a9a1" +string(4) "a9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "aa40" +string(4) "aa7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "aaa1" +string(4) "aafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ab40" +string(4) "ab7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "aba1" +string(4) "abfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ac40" +string(4) "ac7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "aca1" +string(4) "acfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ad40" +string(4) "ad7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "ada1" +string(4) "adfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ae40" +string(4) "ae7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "aea1" +string(4) "aefe" +string(0) "" +string(0) "" +string(0) "" +string(4) "af40" +string(4) "af7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "afa1" +string(4) "affe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b040" +string(4) "b07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b0a1" +string(4) "b0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b140" +string(4) "b17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b1a1" +string(4) "b1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b240" +string(4) "b27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b2a1" +string(4) "b2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b340" +string(4) "b37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b3a1" +string(4) "b3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b440" +string(4) "b47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b4a1" +string(4) "b4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b540" +string(4) "b57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b5a1" +string(4) "b5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b640" +string(4) "b67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b6a1" +string(4) "b6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b740" +string(4) "b77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b7a1" +string(4) "b7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b840" +string(4) "b87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b8a1" +string(4) "b8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "b940" +string(4) "b97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "b9a1" +string(4) "b9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ba40" +string(4) "ba7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "baa1" +string(4) "bafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "bb40" +string(4) "bb7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "bba1" +string(4) "bbfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "bc40" +string(4) "bc7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "bca1" +string(4) "bcfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "bd40" +string(4) "bd7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "bda1" +string(4) "bdfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "be40" +string(4) "be7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "bea1" +string(4) "befe" +string(0) "" +string(0) "" +string(0) "" +string(4) "bf40" +string(4) "bf7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "bfa1" +string(4) "bffe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c040" +string(4) "c07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c0a1" +string(4) "c0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c140" +string(4) "c17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c1a1" +string(4) "c1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c240" +string(4) "c27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c2a1" +string(4) "c2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c340" +string(4) "c37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c3a1" +string(4) "c3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c440" +string(4) "c47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c4a1" +string(4) "c4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c540" +string(4) "c57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c5a1" +string(4) "c5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c640" +string(4) "c67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c6a1" +string(4) "c6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c740" +string(4) "c77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c7a1" +string(4) "c7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c840" +string(4) "c87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c8a1" +string(4) "c8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "c940" +string(4) "c97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "c9a1" +string(4) "c9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ca40" +string(4) "ca7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "caa1" +string(4) "cafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "cb40" +string(4) "cb7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "cba1" +string(4) "cbfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "cc40" +string(4) "cc7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "cca1" +string(4) "ccfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "cd40" +string(4) "cd7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "cda1" +string(4) "cdfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ce40" +string(4) "ce7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "cea1" +string(4) "cefe" +string(0) "" +string(0) "" +string(0) "" +string(4) "cf40" +string(4) "cf7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "cfa1" +string(4) "cffe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d040" +string(4) "d07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d0a1" +string(4) "d0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d140" +string(4) "d17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d1a1" +string(4) "d1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d240" +string(4) "d27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d2a1" +string(4) "d2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d340" +string(4) "d37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d3a1" +string(4) "d3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d440" +string(4) "d47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d4a1" +string(4) "d4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d540" +string(4) "d57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d5a1" +string(4) "d5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d640" +string(4) "d67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d6a1" +string(4) "d6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d740" +string(4) "d77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d7a1" +string(4) "d7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d840" +string(4) "d87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d8a1" +string(4) "d8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "d940" +string(4) "d97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "d9a1" +string(4) "d9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "da40" +string(4) "da7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "daa1" +string(4) "dafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "db40" +string(4) "db7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "dba1" +string(4) "dbfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "dc40" +string(4) "dc7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "dca1" +string(4) "dcfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "dd40" +string(4) "dd7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "dda1" +string(4) "ddfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "de40" +string(4) "de7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "dea1" +string(4) "defe" +string(0) "" +string(0) "" +string(0) "" +string(4) "df40" +string(4) "df7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "dfa1" +string(4) "dffe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e040" +string(4) "e07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e0a1" +string(4) "e0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e140" +string(4) "e17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e1a1" +string(4) "e1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e240" +string(4) "e27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e2a1" +string(4) "e2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e340" +string(4) "e37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e3a1" +string(4) "e3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e440" +string(4) "e47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e4a1" +string(4) "e4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e540" +string(4) "e57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e5a1" +string(4) "e5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e640" +string(4) "e67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e6a1" +string(4) "e6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e740" +string(4) "e77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e7a1" +string(4) "e7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e840" +string(4) "e87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e8a1" +string(4) "e8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "e940" +string(4) "e97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "e9a1" +string(4) "e9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ea40" +string(4) "ea7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "eaa1" +string(4) "eafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "eb40" +string(4) "eb7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "eba1" +string(4) "ebfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ec40" +string(4) "ec7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "eca1" +string(4) "ecfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ed40" +string(4) "ed7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "eda1" +string(4) "edfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ee40" +string(4) "ee7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "eea1" +string(4) "eefe" +string(0) "" +string(0) "" +string(0) "" +string(4) "ef40" +string(4) "ef7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "efa1" +string(4) "effe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f040" +string(4) "f07e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f0a1" +string(4) "f0fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f140" +string(4) "f17e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f1a1" +string(4) "f1fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f240" +string(4) "f27e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f2a1" +string(4) "f2fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f340" +string(4) "f37e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f3a1" +string(4) "f3fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f440" +string(4) "f47e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f4a1" +string(4) "f4fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f540" +string(4) "f57e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f5a1" +string(4) "f5fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f640" +string(4) "f67e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f6a1" +string(4) "f6fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f740" +string(4) "f77e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f7a1" +string(4) "f7fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f840" +string(4) "f87e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f8a1" +string(4) "f8fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "f940" +string(4) "f97e" +string(0) "" +string(0) "" +string(0) "" +string(4) "f9a1" +string(4) "f9fe" +string(0) "" +string(0) "" +string(0) "" +string(4) "fa40" +string(4) "fa7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "faa1" +string(4) "fafe" +string(0) "" +string(0) "" +string(0) "" +string(4) "fb40" +string(4) "fb7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "fba1" +string(4) "fbfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "fc40" +string(4) "fc7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "fca1" +string(4) "fcfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "fd40" +string(4) "fd7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "fda1" +string(4) "fdfe" +string(0) "" +string(0) "" +string(0) "" +string(4) "fe40" +string(4) "fe7e" +string(0) "" +string(0) "" +string(0) "" +string(4) "fea1" +string(4) "fefe" +string(0) "" diff --git a/tests/std/strings/bug50052.phpt b/tests/std/strings/bug50052.phpt new file mode 100644 index 00000000..97a4481e --- /dev/null +++ b/tests/std/strings/bug50052.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #50052 (Different Hashes on Windows and Linux on wrong Salt size) +--FILE-- + +--EXPECT-- +$1$f+uslYF01$ +$1$f+uslYF0$orVloNmKSLvOeswusE0bY. diff --git a/tests/std/strings/bug50847.phpt b/tests/std/strings/bug50847.phpt new file mode 100644 index 00000000..1f708193 --- /dev/null +++ b/tests/std/strings/bug50847.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #50847 (strip_tags() removes all tags greater than 1023 bytes long) +--FILE-- +'; +var_dump(strip_tags($var, ""), strip_tags($var)); +?> +--EXPECT-- +string(2066) "" +string(0) "" diff --git a/tests/std/strings/bug51059.phpt b/tests/std/strings/bug51059.phpt new file mode 100644 index 00000000..d17305ca --- /dev/null +++ b/tests/std/strings/bug51059.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #51059 crypt() segfaults on certain salts +--FILE-- + +--EXPECT-- +OK diff --git a/tests/std/strings/bug51899.phpt b/tests/std/strings/bug51899.phpt new file mode 100644 index 00000000..55fd535f --- /dev/null +++ b/tests/std/strings/bug51899.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #51899 (Parse error in parse_ini_file() function when empy value followed by no newline) +--FILE-- + +--EXPECT-- +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(0) "" +} +array(1) { + ["a"]=> + string(2) "b " +} +array(0) { +} +array(0) { +} diff --git a/tests/std/strings/bug53021.phpt b/tests/std/strings/bug53021.phpt new file mode 100644 index 00000000..4f70f213 --- /dev/null +++ b/tests/std/strings/bug53021.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1) +--FILE-- + +--EXPECT-- +array(1) { + [1]=> + string(2) "e9" +} +double quotes variations: +" +" +" +" +" +" +" +" + +single quotes variations: +' +' +' +' diff --git a/tests/std/strings/bug53319.phpt b/tests/std/strings/bug53319.phpt new file mode 100644 index 00000000..bae7e88b --- /dev/null +++ b/tests/std/strings/bug53319.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #53319 (Strip_tags() may strip '
' incorrectly) +--FILE-- +
USD
CDN
'; +var_dump(strip_tags($str, '')); +var_dump(strip_tags($str, '
') === $str); +var_dump(strip_tags($str)); +var_dump(strip_tags('
', '')); + +?> +--EXPECT-- +string(47) "USDCDN" +bool(true) +string(6) "USDCDN" +string(0) "" diff --git a/tests/std/strings/bug54055.phpt b/tests/std/strings/bug54055.phpt new file mode 100644 index 00000000..4ef2f7d4 --- /dev/null +++ b/tests/std/strings/bug54055.phpt @@ -0,0 +1,590 @@ +--TEST-- +Bug #54055: PHP crashes when executing strval when precision setting is very high +--FILE-- + +--EXPECT-- +495: len=502 +496: len=503 +497: len=504 +498: len=505 +499: len=506 +500: len=507 +501: len=508 +502: len=509 +503: len=510 +504: len=511 +505: len=512 +506: len=513 +507: len=514 +508: len=515 +509: len=516 +510: len=517 +511: len=517 +512: len=519 +513: len=520 +514: len=521 +515: len=521 +516: len=523 +517: len=524 +518: len=525 +519: len=526 +520: len=527 +521: len=528 +522: len=529 +523: len=529 +524: len=531 +525: len=532 +526: len=532 +527: len=534 +528: len=535 +529: len=536 +530: len=537 +531: len=538 +532: len=539 +533: len=540 +534: len=541 +535: len=542 +536: len=543 +537: len=544 +538: len=545 +539: len=546 +540: len=547 +541: len=548 +542: len=549 +543: len=550 +544: len=551 +545: len=552 +546: len=553 +547: len=554 +548: len=555 +549: len=555 +550: len=557 +551: len=557 +552: len=559 +553: len=560 +554: len=561 +555: len=562 +556: len=563 +557: len=564 +558: len=565 +559: len=566 +560: len=567 +561: len=568 +562: len=569 +563: len=570 +564: len=571 +565: len=572 +566: len=573 +567: len=574 +568: len=575 +569: len=576 +570: len=577 +571: len=578 +572: len=579 +573: len=580 +574: len=581 +575: len=582 +576: len=583 +577: len=584 +578: len=585 +579: len=586 +580: len=587 +581: len=588 +582: len=589 +583: len=590 +584: len=591 +585: len=591 +586: len=593 +587: len=594 +588: len=595 +589: len=596 +590: len=597 +591: len=598 +592: len=598 +593: len=600 +594: len=600 +595: len=600 +596: len=603 +597: len=604 +598: len=605 +599: len=606 +600: len=607 +601: len=608 +602: len=608 +603: len=610 +604: len=611 +605: len=611 +606: len=613 +607: len=614 +608: len=615 +609: len=616 +610: len=617 +611: len=618 +612: len=619 +613: len=620 +614: len=621 +615: len=622 +616: len=623 +617: len=624 +618: len=625 +619: len=626 +620: len=627 +621: len=628 +622: len=629 +623: len=630 +624: len=631 +625: len=632 +626: len=633 +627: len=633 +628: len=635 +629: len=636 +630: len=637 +631: len=638 +632: len=639 +633: len=639 +634: len=641 +635: len=642 +636: len=643 +637: len=644 +638: len=645 +639: len=645 +640: len=647 +641: len=648 +642: len=649 +643: len=650 +644: len=650 +645: len=652 +646: len=653 +647: len=654 +648: len=655 +649: len=656 +650: len=657 +651: len=658 +652: len=659 +653: len=660 +654: len=661 +655: len=662 +656: len=663 +657: len=664 +658: len=665 +659: len=665 +660: len=667 +661: len=668 +662: len=669 +663: len=670 +664: len=671 +665: len=672 +666: len=673 +667: len=673 +668: len=675 +669: len=676 +670: len=677 +671: len=678 +672: len=678 +673: len=680 +674: len=680 +675: len=682 +676: len=683 +677: len=684 +678: len=685 +679: len=686 +680: len=687 +681: len=688 +682: len=688 +683: len=690 +684: len=691 +685: len=692 +686: len=693 +687: len=694 +688: len=695 +689: len=696 +690: len=697 +691: len=698 +692: len=699 +693: len=699 +694: len=701 +695: len=702 +696: len=703 +697: len=704 +698: len=705 +699: len=706 +700: len=706 +701: len=708 +702: len=709 +703: len=710 +704: len=711 +705: len=712 +706: len=713 +707: len=714 +708: len=715 +709: len=716 +710: len=717 +711: len=718 +712: len=719 +713: len=720 +714: len=721 +715: len=722 +716: len=723 +717: len=724 +718: len=725 +719: len=726 +720: len=727 +721: len=728 +722: len=729 +723: len=730 +724: len=731 +725: len=732 +726: len=733 +727: len=734 +728: len=735 +729: len=736 +730: len=737 +731: len=738 +732: len=739 +733: len=739 +734: len=741 +735: len=742 +736: len=743 +737: len=744 +738: len=745 +739: len=746 +740: len=747 +741: len=748 +742: len=749 +743: len=750 +744: len=751 +745: len=752 +746: len=753 +747: len=754 +748: len=755 +749: len=756 +750: len=757 +751: len=758 +752: len=758 +753: len=758 +754: len=758 +755: len=758 +756: len=758 +757: len=758 +758: len=758 +759: len=758 +760: len=758 +761: len=758 +762: len=758 +763: len=758 +764: len=758 +765: len=758 +766: len=758 +767: len=758 +768: len=758 +769: len=758 +770: len=758 +771: len=758 +772: len=758 +773: len=758 +774: len=758 +775: len=758 +776: len=758 +777: len=758 +778: len=758 +779: len=758 +780: len=758 +781: len=758 +782: len=758 +783: len=758 +784: len=758 +785: len=758 +786: len=758 +787: len=758 +788: len=758 +789: len=758 +790: len=758 +791: len=758 +792: len=758 +793: len=758 +794: len=758 +795: len=758 +796: len=758 +797: len=758 +798: len=758 +799: len=758 +800: len=758 +801: len=758 +802: len=758 +803: len=758 +804: len=758 +805: len=758 +806: len=758 +807: len=758 +808: len=758 +809: len=758 +810: len=758 +811: len=758 +812: len=758 +813: len=758 +814: len=758 +815: len=758 +816: len=758 +817: len=758 +818: len=758 +819: len=758 +820: len=758 +821: len=758 +822: len=758 +823: len=758 +824: len=758 +825: len=758 +826: len=758 +827: len=758 +828: len=758 +829: len=758 +830: len=758 +831: len=758 +832: len=758 +833: len=758 +834: len=758 +835: len=758 +836: len=758 +837: len=758 +838: len=758 +839: len=758 +840: len=758 +841: len=758 +842: len=758 +843: len=758 +844: len=758 +845: len=758 +846: len=758 +847: len=758 +848: len=758 +849: len=758 +850: len=758 +851: len=758 +852: len=758 +853: len=758 +854: len=758 +855: len=758 +856: len=758 +857: len=758 +858: len=758 +859: len=758 +860: len=758 +861: len=758 +862: len=758 +863: len=758 +864: len=758 +865: len=758 +866: len=758 +867: len=758 +868: len=758 +869: len=758 +870: len=758 +871: len=758 +872: len=758 +873: len=758 +874: len=758 +875: len=758 +876: len=758 +877: len=758 +878: len=758 +879: len=758 +880: len=758 +881: len=758 +882: len=758 +883: len=758 +884: len=758 +885: len=758 +886: len=758 +887: len=758 +888: len=758 +889: len=758 +890: len=758 +891: len=758 +892: len=758 +893: len=758 +894: len=758 +895: len=758 +896: len=758 +897: len=758 +898: len=758 +899: len=758 +900: len=758 +901: len=758 +902: len=758 +903: len=758 +904: len=758 +905: len=758 +906: len=758 +907: len=758 +908: len=758 +909: len=758 +910: len=758 +911: len=758 +912: len=758 +913: len=758 +914: len=758 +915: len=758 +916: len=758 +917: len=758 +918: len=758 +919: len=758 +920: len=758 +921: len=758 +922: len=758 +923: len=758 +924: len=758 +925: len=758 +926: len=758 +927: len=758 +928: len=758 +929: len=758 +930: len=758 +931: len=758 +932: len=758 +933: len=758 +934: len=758 +935: len=758 +936: len=758 +937: len=758 +938: len=758 +939: len=758 +940: len=758 +941: len=758 +942: len=758 +943: len=758 +944: len=758 +945: len=758 +946: len=758 +947: len=758 +948: len=758 +949: len=758 +950: len=758 +951: len=758 +952: len=758 +953: len=758 +954: len=758 +955: len=758 +956: len=758 +957: len=758 +958: len=758 +959: len=758 +960: len=758 +961: len=758 +962: len=758 +963: len=758 +964: len=758 +965: len=758 +966: len=758 +967: len=758 +968: len=758 +969: len=758 +970: len=758 +971: len=758 +972: len=758 +973: len=758 +974: len=758 +975: len=758 +976: len=758 +977: len=758 +978: len=758 +979: len=758 +980: len=758 +981: len=758 +982: len=758 +983: len=758 +984: len=758 +985: len=758 +986: len=758 +987: len=758 +988: len=758 +989: len=758 +990: len=758 +991: len=758 +992: len=758 +993: len=758 +994: len=758 +995: len=758 +996: len=758 +997: len=758 +998: len=758 +999: len=758 +1000: len=758 +1001: len=758 +1002: len=758 +1003: len=758 +1004: len=758 +1005: len=758 +1006: len=758 +1007: len=758 +1008: len=758 +1009: len=758 +1010: len=758 +1011: len=758 +1012: len=758 +1013: len=758 +1014: len=758 +1015: len=758 +1016: len=758 +1017: len=758 +1018: len=758 +1019: len=758 +1020: len=758 +1021: len=758 +1022: len=758 +1023: len=758 +1024: len=758 +1025: len=758 +1026: len=758 +1027: len=758 +1028: len=758 +1029: len=758 +1030: len=758 +1031: len=758 +1032: len=758 +1033: len=758 +1034: len=758 +1035: len=758 +1036: len=758 +1037: len=758 +1038: len=758 +1039: len=758 +1040: len=758 +1041: len=758 +1042: len=758 +1043: len=758 +1044: len=758 +1045: len=758 +1046: len=758 +1047: len=758 +1048: len=758 +1049: len=758 +1050: len=758 +1051: len=758 +1052: len=758 +1053: len=758 +1054: len=758 +1055: len=758 +1056: len=758 +1057: len=758 +1058: len=758 +1059: len=758 +1060: len=758 +1061: len=758 +1062: len=758 +1063: len=758 +1064: len=758 +1065: len=758 +1066: len=758 +1067: len=758 +1068: len=758 +1069: len=758 +1070: len=758 +1071: len=758 +1072: len=758 +1073: len=758 +1074: len=758 diff --git a/tests/std/strings/bug54238.phpt b/tests/std/strings/bug54238.phpt new file mode 100644 index 00000000..e679bb69 --- /dev/null +++ b/tests/std/strings/bug54238.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #54238 (use-after-free in substr_replace()) +--FILE-- + +--EXPECTF-- +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +array(1) { + [0]=> + string(9) "AArrayray" +} +array(1) { + [0]=> + array(2) { + [0]=> + string(1) "A" + [1]=> + string(1) "A" + } +} diff --git a/tests/std/strings/bug54322.phpt b/tests/std/strings/bug54322.phpt new file mode 100644 index 00000000..8f12cd80 --- /dev/null +++ b/tests/std/strings/bug54322.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion +--FILE-- + 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table(): Argument #1 ($table) must be of type int, float given diff --git a/tests/std/strings/bug54332.phpt b/tests/std/strings/bug54332.phpt new file mode 100644 index 00000000..122b387e --- /dev/null +++ b/tests/std/strings/bug54332.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #54332 (Crash in zend_mm_check_ptr // Heap corruption) +--FILE-- + +--EXPECT-- +1 000 000 000 000 000 052 504 760 255 204 420 248 704 468 581 108 159 154 915 854 115 511 802 457 988 908 195 786 371 375 080 447 864 043 704 443 832 883 878 176 942 523 235 360 430 575 644 792 184 786 706 982 848 387 200 926 575 803 737 830 233 794 788 090 059 368 953 234 970 799 945 081 119 038 967 640 880 074 652 742 780 142 494 579 258 788 820 056 842 838 115 669 472 196 386 865 459 400 540 16000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tests/std/strings/bug54454.phpt b/tests/std/strings/bug54454.phpt new file mode 100644 index 00000000..783fe43c --- /dev/null +++ b/tests/std/strings/bug54454.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #54454 (substr_compare incorrectly reports equality in some cases) +--FILE-- + +--EXPECT-- +int(-1) diff --git a/tests/std/strings/bug54721.phpt b/tests/std/strings/bug54721.phpt new file mode 100644 index 00000000..f21d65fd --- /dev/null +++ b/tests/std/strings/bug54721.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #54721 (Different Hashes on Windows, BSD and Linux on wrong Salt size) +--FILE-- + +--EXPECT-- +$1$dW0.is5.$I0iqTYHPzkP4YnRgnXxZW0 +$1$dW0.is5.$KaspRpPQ9U7Xb5Vv5c.WE/ +$1$dW0.is5.$X9G1x/Ep8zYQSrU4/lKUg. +$1$dW0.is5.$wE5Rz/HxPtDMfqil6kK980 +$1$dW0.is5.$2E4/ZDY1vr73HqLl1bLs9. +$1$dW0.is5.$lvGhphTQwqgKxWhWwYERr1 +$1$dW0.is5.$XzsWcLSBj2BvhOKH0xdpZ0 diff --git a/tests/std/strings/bug55451.phpt b/tests/std/strings/bug55451.phpt new file mode 100644 index 00000000..47599650 --- /dev/null +++ b/tests/std/strings/bug55451.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #55451 (substr_compare with NULL as default length) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/tests/std/strings/bug55674.phpt b/tests/std/strings/bug55674.phpt new file mode 100644 index 00000000..60572e71 --- /dev/null +++ b/tests/std/strings/bug55674.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #55674 (fgetcsv & str_getcsv skip empty fields in some tab-separated records) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + string(1) "0" + [1]=> + string(0) "" + [2]=> + string(1) "2" +} +array(3) { + [0]=> + string(1) "0" + [1]=> + string(1) " " + [2]=> + string(1) "2" +} +array(5) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" +} +array(5) { + [0]=> + string(1) " " + [1]=> + string(2) " " + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(1) " " +} diff --git a/tests/std/strings/bug55871.phpt b/tests/std/strings/bug55871.phpt new file mode 100644 index 00000000..f25aa334 --- /dev/null +++ b/tests/std/strings/bug55871.phpt @@ -0,0 +1,60 @@ +--TEST-- +Bug #55871 (Interruption in substr_replace()) (PHP7) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +} +array(1) { + [0]=> + string(0) "" +} + +Warning: A non-numeric value encountered in %s on line %d +array(1) { + [0]=> + string(40) "0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +} +int(134512640) +array(1) { + [0]=> + string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +} +string(48) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" diff --git a/tests/std/strings/bug60801.phpt b/tests/std/strings/bug60801.phpt new file mode 100644 index 00000000..a87f4756 --- /dev/null +++ b/tests/std/strings/bug60801.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #60801 (strpbrk() mishandles NUL byte) +--FILE-- + +--EXPECTF-- +string(2) "ar" +string(3) "%0ar" +string(4) "b%0ar" +string(3) "bar" +string(1) "%0" +bool(false) +bool(false) diff --git a/tests/std/strings/bug60965.phpt b/tests/std/strings/bug60965.phpt new file mode 100644 index 00000000..b370d225 --- /dev/null +++ b/tests/std/strings/bug60965.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #60965: Buffer overflow on htmlspecialchars/entities with $double=false +--FILE-- + +--EXPECT-- +""""""""""""""""""""""""""""""""""""""""""""" +Done. diff --git a/tests/std/strings/bug61038.phpt b/tests/std/strings/bug61038.phpt new file mode 100644 index 00000000..7e1a1e4e --- /dev/null +++ b/tests/std/strings/bug61038.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #61038: unpack("a5", "str\0\0") does not work as expected +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(1) { + [1]=> + string(4) "str%c" +} +array(1) { + [1]=> + string(5) "str%c%c" +} + +Warning: unpack(): Type a: not enough input values, need 6 values but only 5 were provided in %s on line %d +bool(false) +array(1) { + [1]=> + string(5) "str%c%c" +} diff --git a/tests/std/strings/bug61116.phpt b/tests/std/strings/bug61116.phpt new file mode 100644 index 00000000..53e2e833 --- /dev/null +++ b/tests/std/strings/bug61116.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #61116 (HTML functions use encoding, not charset) +--FILE-- + +--EXPECT-- +Function [ function htmlspecialchars ] { + + - Parameters [4] { + Parameter #0 [ string $string ] + Parameter #1 [ int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ] + Parameter #2 [ ?string $encoding = null ] + Parameter #3 [ bool $double_encode = true ] + } + - Return [ string ] +} + +Function [ function get_html_translation_table ] { + + - Parameters [3] { + Parameter #0 [ int $table = HTML_SPECIALCHARS ] + Parameter #1 [ int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ] + Parameter #2 [ string $encoding = "UTF-8" ] + } + - Return [ array ] +} diff --git a/tests/std/strings/bug61374.phpt b/tests/std/strings/bug61374.phpt new file mode 100644 index 00000000..0607e01b --- /dev/null +++ b/tests/std/strings/bug61374.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1 +--FILE-- + +--EXPECT-- +Œ diff --git a/tests/std/strings/bug61660.phpt b/tests/std/strings/bug61660.phpt new file mode 100644 index 00000000..0eb74bf2 --- /dev/null +++ b/tests/std/strings/bug61660.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #61660: bin2hex(hex2bin($data)) != $data +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: hex2bin(): Hexadecimal input string must have an even length in %s on line %d +bool(false) diff --git a/tests/std/strings/bug61764.phpt b/tests/std/strings/bug61764.phpt new file mode 100644 index 00000000..8c5b6db1 --- /dev/null +++ b/tests/std/strings/bug61764.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #61764: 'I' unpacks n as signed if n > 2^31-1 on LP64 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Array +( + [1] => 4294937296 +) diff --git a/tests/std/strings/bug62443.phpt b/tests/std/strings/bug62443.phpt new file mode 100644 index 00000000..49b0b134 --- /dev/null +++ b/tests/std/strings/bug62443.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #62443 Crypt SHA256/512 Segfaults With Malformed Salt +--FILE-- + +--EXPECT-- +OK! diff --git a/tests/std/strings/bug62462.phpt b/tests/std/strings/bug62462.phpt new file mode 100644 index 00000000..ac382800 --- /dev/null +++ b/tests/std/strings/bug62462.phpt @@ -0,0 +1,14 @@ +--TEST-- +Multibyte characters shouldn't be split by soft line break added by quoted_printable_encode - 4 byte character test +--FILE-- + +--EXPECT-- +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85= +=C4=85=C4=85=C4=85=C4=85=C4=85 diff --git a/tests/std/strings/bug63874.phpt b/tests/std/strings/bug63874.phpt new file mode 100644 index 00000000..ab118f91 --- /dev/null +++ b/tests/std/strings/bug63874.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #63874 (Segfault if php_strip_whitespace has heredoc) +--SKIPIF-- + +--FILE-- + +--EXPECT-- + diff --git a/tests/std/strings/bug64879.phpt b/tests/std/strings/bug64879.phpt new file mode 100644 index 00000000..6135fbbb --- /dev/null +++ b/tests/std/strings/bug64879.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #64879: quoted_printable_encode() wrong size calculation (CVE-2013-2110) +--FILE-- + +--EXPECT-- +Done diff --git a/tests/std/strings/bug65230.phpt b/tests/std/strings/bug65230.phpt new file mode 100644 index 00000000..9cce006f --- /dev/null +++ b/tests/std/strings/bug65230.phpt @@ -0,0 +1,61 @@ +--TEST-- +Bug #65230 setting locale randomly broken +--SKIPIF-- + +--INI-- +date.timezone=Europe/Berlin +error_reporting=E_ALL&~E_DEPRECATED +--FILE-- + +--EXPECT-- +German_Germany.1252 +-------------------------- + sep: , + %f: 3,410000 + %F: 3.410000 +date: 05.12.2014 + +English_United States.1252 +-------------------------- + sep: . + %f: 3.410000 + %F: 3.410000 +date: 12/5/2014 + +French_France.1252 +-------------------------- + sep: , + %f: 3,410000 + %F: 3.410000 +date: 05/12/2014 + +German_Germany.1252 +-------------------------- + sep: , + %f: 3,410000 + %F: 3.410000 +date: 05.12.2014 diff --git a/tests/std/strings/bug65769.phpt b/tests/std/strings/bug65769.phpt new file mode 100644 index 00000000..aedc3036 --- /dev/null +++ b/tests/std/strings/bug65769.phpt @@ -0,0 +1,87 @@ +--TEST-- +Bug #65769 localeconv() broken in TS builds +--SKIPIF-- + +--FILE-- + ++++DONE+++ +--EXPECTF-- +string(19) "Swedish_Sweden.1252" +string(1) "," +string(1) " " +string(3) "SEK" +string(2) "kr" +string(1) "," +string(1) "%c" +bool(true) +++++++++++++++++++++++ +string(18) "French_France.1252" +string(1) "," +string(1) " " +string(3) "EUR" +string(1) "€" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(26) "English_United States.1252" +string(1) "." +string(1) "," +string(3) "USD" +string(1) "$" +string(1) "." +string(1) "," +++++++++++++++++++++++ +string(2) "ru" +string(1) "," +string(1) " " +string(3) "RUB" +string(1) "?" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(%d) "Czech_Czech%s.1250" +string(1) "," +string(1) " " +string(3) "CZK" +string(2) "Kè" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(19) "Serbian_Serbia.1250" +string(1) "," +string(1) "." +string(3) "RSD" +string(3) "RSD" +string(1) "," +string(1) "." +++++++++++++++++++++++ ++++DONE+++ diff --git a/tests/std/strings/bug65947.phpt b/tests/std/strings/bug65947.phpt new file mode 100644 index 00000000..1df0e004 --- /dev/null +++ b/tests/std/strings/bug65947.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #65947 (basename is no more working after fgetcsv in certain situation) +--FILE-- + +--EXPECT-- +OKEY diff --git a/tests/std/strings/bug67151.phpt b/tests/std/strings/bug67151.phpt new file mode 100644 index 00000000..1d0c02a5 --- /dev/null +++ b/tests/std/strings/bug67151.phpt @@ -0,0 +1,8 @@ +--TEST-- +Buf #67151: strtr with empty array crashes +--FILE-- + +--EXPECT-- +string(3) "foo" diff --git a/tests/std/strings/bug67249.phpt b/tests/std/strings/bug67249.phpt new file mode 100644 index 00000000..a0e0843f --- /dev/null +++ b/tests/std/strings/bug67249.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #67249 (printf out-of-bounds read) +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Missing padding character diff --git a/tests/std/strings/bug67252.phpt b/tests/std/strings/bug67252.phpt new file mode 100644 index 00000000..95997a73 --- /dev/null +++ b/tests/std/strings/bug67252.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #67252 (convert_uudecode out-of-bounds read) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: convert_uudecode(): Argument #1 ($data) is not a valid uuencoded string in %s on line %d +bool(false) diff --git a/tests/std/strings/bug68636.phpt b/tests/std/strings/bug68636.phpt new file mode 100644 index 00000000..246722c7 --- /dev/null +++ b/tests/std/strings/bug68636.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #68636 (setlocale no longer returns current value per category). +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(10) "en_US.UTF8" +string(1) "C" +string(10) "en_US.UTF8" diff --git a/tests/std/strings/bug68710.phpt b/tests/std/strings/bug68710.phpt new file mode 100644 index 00000000..0f12b1f5 --- /dev/null +++ b/tests/std/strings/bug68710.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #68710 Use after free vulnerability in unserialize() (bypassing the +CVE-2014-8142 fix) +--SKIPIF-- + +--FILE-- +aaa = array(1,2,&$u,4,5); + $m->bbb = 1; + $m->ccc = &$u; + $m->ddd = str_repeat("A", $i); + + $z = serialize($m); + $z = str_replace("aaa", "123", $z); + $z = str_replace("bbb", "123", $z); + $y = unserialize($z); + $z = serialize($y); +} +?> +===DONE=== +?> +--EXPECT-- +===DONE=== diff --git a/tests/std/strings/bug68996.phpt b/tests/std/strings/bug68996.phpt new file mode 100644 index 00000000..85029ef7 --- /dev/null +++ b/tests/std/strings/bug68996.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #68996 (Invalid free of CG(interned_empty_string)) +--SKIPIF-- + +--INI-- +html_errors=1 +--FILE-- + +--EXPECTF-- +
+Warning: fopen(�c): Failed to open stream: No such file or directory in %sbug68996.php on line 2
diff --git a/tests/std/strings/bug69144.phpt b/tests/std/strings/bug69144.phpt new file mode 100644 index 00000000..ded915b4 --- /dev/null +++ b/tests/std/strings/bug69144.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #69144 (strtr not replacing with partly matching replace pairs) +--FILE-- + '', 'foo' => 'o', 'foobar' => '', 'hello' => 'hello'); + +foreach ($tests as $input => $expected) { + if ($expected !== ($actual = strtr($input, array("fo" => "", "foobar" => "", "bar" => "")))) { + echo "KO `$input` became `$actual` instead of `$expected`\n"; + } +} +echo "okey"; +?> +--EXPECT-- +okey diff --git a/tests/std/strings/bug69522.phpt b/tests/std/strings/bug69522.phpt new file mode 100644 index 00000000..119543bd --- /dev/null +++ b/tests/std/strings/bug69522.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #69522 (heap buffer overflow in unpack()) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: unpack(): Type h: integer overflow in %s on line %d diff --git a/tests/std/strings/bug69751.phpt b/tests/std/strings/bug69751.phpt new file mode 100644 index 00000000..f75af897 --- /dev/null +++ b/tests/std/strings/bug69751.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #69751: Change Error message of sprintf/printf for missing/typo position specifier. +--FILE-- +getMessage(), "\n"; +} + +try { + sprintf('%3$s, %2$s %1$s', "a", "b"); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +try { + sprintf('%2147483648$s, %2$s %1$s', "a", "b"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECTF-- +Argument number specifier must be greater than zero and less than %d +4 arguments are required, 3 given +Argument number specifier must be greater than zero and less than %d diff --git a/tests/std/strings/bug70487.phpt b/tests/std/strings/bug70487.phpt new file mode 100644 index 00000000..e4ca1ff0 --- /dev/null +++ b/tests/std/strings/bug70487.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #70487: pack('x') produces an error +--FILE-- + +--EXPECT-- +bool(true) diff --git a/tests/std/strings/bug70667.phpt b/tests/std/strings/bug70667.phpt new file mode 100644 index 00000000..fd3deadb --- /dev/null +++ b/tests/std/strings/bug70667.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #70667 (strtr() causes invalid writes and a crashes) +--FILE-- +"255", "{{partner_name}}"=>"test1"); +var_dump(strtr("Sign in to test1", $a)); +?> +--EXPECT-- +string(16) "Sign in to test1" diff --git a/tests/std/strings/bug70720.phpt b/tests/std/strings/bug70720.phpt new file mode 100644 index 00000000..cdfa4794 --- /dev/null +++ b/tests/std/strings/bug70720.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #70720 (strip_tags() doesn't handle "xml" correctly) +--FILE-- +test(); ?> this is a test')); +var_dump(strip_tags('test(); ?> this is a test')); +var_dump(strip_tags('test(); ?> this is a test')); + +/* "->" case in HTML */ +var_dump(strip_tags(" this is a test")); +?> +--EXPECT-- +string(15) " this is a test" +string(15) " this is a test" +string(15) " this is a test" +string(15) " this is a test" diff --git a/tests/std/strings/bug71188.phpt b/tests/std/strings/bug71188.phpt new file mode 100644 index 00000000..10738253 --- /dev/null +++ b/tests/std/strings/bug71188.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #71188 (str_replace converts integers in original $search array to strings) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} diff --git a/tests/std/strings/bug71190.phpt b/tests/std/strings/bug71190.phpt new file mode 100644 index 00000000..feabe7c1 --- /dev/null +++ b/tests/std/strings/bug71190.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #71190 (substr_replace converts integers in original $search array to strings) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} +array(3) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) +} diff --git a/tests/std/strings/bug71806.phpt b/tests/std/strings/bug71806.phpt new file mode 100644 index 00000000..ea7658e1 --- /dev/null +++ b/tests/std/strings/bug71806.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #71806 (php_strip_whitespace() fails on some numerical values) +--SKIPIF-- + +--FILE-- + +--EXPECT-- + array("a"=>"0000", "b"=>"1111")), +); + +//foreach by reference, changing the array value +foreach($a as &$record) +{ + $record["one"]["a"] = "2222"; +} +var_dump(str_replace("2", "3", $a)); +?> +--EXPECTF-- +Warning: Array to string conversion in %s on line %d +array(1) { + [0]=> + string(5) "Array" +} diff --git a/tests/std/strings/bug72100.phpt b/tests/std/strings/bug72100.phpt new file mode 100644 index 00000000..7fcc0831 --- /dev/null +++ b/tests/std/strings/bug72100.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test implode() function, problems with big numbers +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(49) "hello long 999999999999999999 9223372036854775807" +string(60) "hello negative long -999999999999999999 -9223372036854775808" +string(76) "hello small long -101 -100 -99 -90 -11 -10 -9 -1 0 1 2 9 10 11 90 99 100 101" +Done diff --git a/tests/std/strings/bug72146.phpt b/tests/std/strings/bug72146.phpt new file mode 100644 index 00000000..72b33257 --- /dev/null +++ b/tests/std/strings/bug72146.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #72146 (Integer overflow on substr_replace) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(6) "ABC123" +} diff --git a/tests/std/strings/bug72152.phpt b/tests/std/strings/bug72152.phpt new file mode 100644 index 00000000..02f49882 --- /dev/null +++ b/tests/std/strings/bug72152.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #72152 (base64_decode $strict fails to detect null byte) +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) diff --git a/tests/std/strings/bug72263.phpt b/tests/std/strings/bug72263.phpt new file mode 100644 index 00000000..c6694f02 --- /dev/null +++ b/tests/std/strings/bug72263.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #72263 (base64_decode skips a character after padding in strict mode) +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +string(2) "UU" +bool(false) diff --git a/tests/std/strings/bug72264.phpt b/tests/std/strings/bug72264.phpt new file mode 100644 index 00000000..da597d26 --- /dev/null +++ b/tests/std/strings/bug72264.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #72264 (base64_decode $strict fails with whitespace between padding) +--FILE-- + +--EXPECT-- +string(1) "U" diff --git a/tests/std/strings/bug72433.phpt b/tests/std/strings/bug72433.phpt new file mode 100644 index 00000000..e298e88a --- /dev/null +++ b/tests/std/strings/bug72433.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: unserialize(): Error at offset 13 of 69 bytes in %s on line %d +bool(false) diff --git a/tests/std/strings/bug72434.phpt b/tests/std/strings/bug72434.phpt new file mode 100644 index 00000000..6d64baa2 --- /dev/null +++ b/tests/std/strings/bug72434.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize +--FILE-- + rc is 0 +$a = $unserialized_payload[1]; +// Increment the reference counter by 1 again -> rc is 1 +$b = $a; +// Trigger free of $free_me (referenced by $m[1]). +unset($b); +$fill_freed_space_1 = "filler_zval_1"; +$fill_freed_space_2 = "filler_zval_2"; +$fill_freed_space_3 = "filler_zval_3"; +$fill_freed_space_4 = "filler_zval_4"; +debug_zval_dump($unserialized_payload[1]); +?> +--EXPECTF-- +array(1) refcount(3){ + [0]=> + object(stdClass)#%d (0) refcount(1){ + } +} diff --git a/tests/std/strings/bug72663.phpt b/tests/std/strings/bug72663.phpt new file mode 100644 index 00000000..92bfc8e9 --- /dev/null +++ b/tests/std/strings/bug72663.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization +--SKIPIF-- + +--FILE-- +data); + } + function unserialize($data) { + $this->data = unserialize($data); + } +} + +$inner = 'a:1:{i:0;O:9:"Exception":2:{s:7:"'."\0".'*'."\0".'file";s:0:"";}'; +$exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}'; + +var_dump(unserialize($exploit)); +?> +DONE +--EXPECTF-- +Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d + +Warning: unserialize(): Unexpected end of serialized data in %s on line %d + +Warning: unserialize(): Error at offset 49 of 50 bytes in %s on line %d + +Warning: unserialize(): Error at offset 82 of 83 bytes in %s on line %d +bool(false) +DONE diff --git a/tests/std/strings/bug72663_2.phpt b/tests/std/strings/bug72663_2.phpt new file mode 100644 index 00000000..7b279997 --- /dev/null +++ b/tests/std/strings/bug72663_2.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization +--SKIPIF-- + +--EXTENSIONS-- +session +--FILE-- + +DONE +?> +--EXPECTF-- +Warning: session_decode(): Unexpected end of serialized data in %s on line %d + +Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d +array(0) { +} +DONE diff --git a/tests/std/strings/bug72663_3.phpt b/tests/std/strings/bug72663_3.phpt new file mode 100644 index 00000000..ffe848e3 --- /dev/null +++ b/tests/std/strings/bug72663_3.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization +--SKIPIF-- + +--FILE-- +ryat = str_repeat('A', 0x112); + } +} + +$poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;'; +unserialize($poc); +?> +DONE +--EXPECTF-- +Warning: unserialize(): Error at offset 50 of 50 bytes in %s on line %d +DONE diff --git a/tests/std/strings/bug72823.phpt b/tests/std/strings/bug72823.phpt new file mode 100644 index 00000000..1571fdc7 --- /dev/null +++ b/tests/std/strings/bug72823.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #72823 (strtr out-of-bound access) +--FILE-- + 'bbb')) +); +?> +--EXPECT-- +string(2) "11" diff --git a/tests/std/strings/bug73058.phpt b/tests/std/strings/bug73058.phpt new file mode 100644 index 00000000..a9cce19f --- /dev/null +++ b/tests/std/strings/bug73058.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #73058 crypt broken when salt is 'too' long +--SKIPIF-- + +--FILE-- + +==OK== +--EXPECT-- +string(60) "$2y$07$usesomesillystringforex.u2VJUMLRWaJNuw0Hu2FvCEimdeYVO" +string(60) "$2y$07$usesomesillystringforex.u2VJUMLRWaJNuw0Hu2FvCEimdeYVO" +string(60) "$2y$07$usesomesillystringforuw2Gm1ef7lMsvtzSK2p/14F0q1e8uOCO" +==OK== diff --git a/tests/std/strings/bug73817.phpt b/tests/std/strings/bug73817.phpt new file mode 100644 index 00000000..541ce97c --- /dev/null +++ b/tests/std/strings/bug73817.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #73817 (Incorrect entries in get_html_translation_table) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/tests/std/strings/bug74041.phpt b/tests/std/strings/bug74041.phpt new file mode 100644 index 00000000..598e46d8 --- /dev/null +++ b/tests/std/strings/bug74041.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #74041: substr_count with length=0 broken +--FILE-- + +--EXPECT-- +int(0) +int(0) diff --git a/tests/std/strings/bug75075.phpt b/tests/std/strings/bug75075.phpt new file mode 100644 index 00000000..f9146b1d --- /dev/null +++ b/tests/std/strings/bug75075.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #75075 (unpack with X* causes infinity loop) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: unpack(): Type X: '*' ignored in %sbug75075.php on line %d +array(0) { +} diff --git a/tests/std/strings/bug77439.phpt b/tests/std/strings/bug77439.phpt new file mode 100644 index 00000000..98ae5622 --- /dev/null +++ b/tests/std/strings/bug77439.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #77439: parse_str segfaults when inserting item into existing array +--FILE-- + []]; +parse_str('a[1]=1', $vars); +var_dump($vars['a']); +?> +--EXPECT-- +array(1) { + [1]=> + string(1) "1" +} diff --git a/tests/std/strings/bug77853.phpt b/tests/std/strings/bug77853.phpt new file mode 100644 index 00000000..ad4f4c59 --- /dev/null +++ b/tests/std/strings/bug77853.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #77853: Inconsistent substr_compare behaviour with empty haystack +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(0) +int(0) +int(-1) diff --git a/tests/std/strings/bug78003.phpt b/tests/std/strings/bug78003.phpt new file mode 100644 index 00000000..2420191f --- /dev/null +++ b/tests/std/strings/bug78003.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #78003 (strip_tags output change since PHP 7.3) +--FILE-- +bar>'), + strip_tags('bar>'), + strip_tags('bar>') +); +?> +--EXPECT-- +string(0) "" +string(0) "" +string(0) "" diff --git a/tests/std/strings/bug78346.phpt b/tests/std/strings/bug78346.phpt new file mode 100644 index 00000000..f2c508f0 --- /dev/null +++ b/tests/std/strings/bug78346.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #78346 (strip_tags no longer handling nested php tags) +--FILE-- +\' ?>2'; +var_dump(strip_tags($str)); +?> +--EXPECT-- +string(1) "2" diff --git a/tests/std/strings/bug78612.phpt b/tests/std/strings/bug78612.phpt new file mode 100644 index 00000000..62bbbf03 --- /dev/null +++ b/tests/std/strings/bug78612.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #78612 (strtr leaks memory when integer keys are used and the subject string shorter). +--FILE-- + +--EXPECT-- +Hello diff --git a/tests/std/strings/bug78814.phpt b/tests/std/strings/bug78814.phpt new file mode 100644 index 00000000..c8ad8373 --- /dev/null +++ b/tests/std/strings/bug78814.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #78814 (strip_tags allows / in tag name => whitelist bypass) +--FILE-- +b", ""); +?> +--EXPECT-- +b diff --git a/tests/std/strings/bug78833.phpt b/tests/std/strings/bug78833.phpt new file mode 100644 index 00000000..7712e133 --- /dev/null +++ b/tests/std/strings/bug78833.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #78833 (Integer overflow in pack causes out-of-bound access) +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Type E: too few arguments diff --git a/tests/std/strings/bug78840.phpt b/tests/std/strings/bug78840.phpt new file mode 100644 index 00000000..bbd81c34 --- /dev/null +++ b/tests/std/strings/bug78840.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #78840 (imploding $GLOBALS crashes) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +done diff --git a/tests/std/strings/bug79951.phpt b/tests/std/strings/bug79951.phpt new file mode 100644 index 00000000..5663ba6c --- /dev/null +++ b/tests/std/strings/bug79951.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #79951: Memory leak in str_replace of empty string +--FILE-- + +--EXPECT-- +string(3) "foo" diff --git a/tests/std/strings/chop_basic.phpt b/tests/std/strings/chop_basic.phpt new file mode 100644 index 00000000..4a11f9c3 --- /dev/null +++ b/tests/std/strings/chop_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test chop() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing chop() : basic functionality *** +string(11) "hello world" +string(16) "hello world + %0 " +string(18) "hello world + %0 " +Done diff --git a/tests/std/strings/chop_variation3.phpt b/tests/std/strings/chop_variation3.phpt new file mode 100644 index 00000000..f1ffce9a --- /dev/null +++ b/tests/std/strings/chop_variation3.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test chop() function : usage variations - with heredoc string +--FILE-- + +--EXPECTF-- +*** Testing chop() : with heredoc strings *** + +--- Iteration 1 --- +string(0) "" +string(0) "" + +--- Iteration 2 --- +string(0) "" +string(0) "" + +--- Iteration 3 --- +string(86) "first line of heredoc string +second line of heredoc string +third line of heredocstring" +string(86) "first line of heredoc string +second line of heredoc string +third line of heredocstring" + +--- Iteration 4 --- +string(23) "hello world +hello +world" +string(23) "hello world +hello +world" + +--- Iteration 5 --- +string(31) "hello123world456 +1234hello 1234" +string(25) "hello123world456 +1234hell" + +--- Iteration 6 --- +string(24) "hello%0world%0hello +%0hello" +string(23) "hello%0world%0hello +%0hell" +Done diff --git a/tests/std/strings/chop_variation4.phpt b/tests/std/strings/chop_variation4.phpt new file mode 100644 index 00000000..8b49b253 --- /dev/null +++ b/tests/std/strings/chop_variation4.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test chop() function : usage variations - strings with embedded nulls +--FILE-- + +--EXPECTF-- +*** Testing chop() : string with embedded nulls *** + +--- Iteration 1 --- +string(11) "hello%0world" +string(11) "hello%0world" +string(11) "hello%0world" + +--- Iteration 2 --- +string(6) "%0hello" +string(6) "%0hello" +string(6) "%0hello" + +--- Iteration 3 --- +string(5) "hello" +string(5) "hello" +string(6) "hello%0" + +--- Iteration 4 --- +string(13) "%0%0hello world" +string(13) "%0%0hello world" +string(15) "%0%0hello world%0%0" + +--- Iteration 5 --- +string(9) "\0hello\0" +string(9) "\0hello\0" +string(7) "\0hello" + +--- Iteration 6 --- +string(9) "hello\0\0" +string(9) "hello\0\0" +string(5) "hello" + +--- Iteration 7 --- +string(0) "" +string(0) "" +string(1) "%0" + +--- Iteration 8 --- +string(0) "" +string(0) "" +string(2) "%0%0" + +--- Iteration 9 --- +string(6) "%0hello" +string(6) "%0hello" +string(7) "%0hello%0" + +--- Iteration 10 --- +string(11) "hello%0world" +string(11) "hello%0world" +string(11) "hello%0world" +Done diff --git a/tests/std/strings/chop_variation5.phpt b/tests/std/strings/chop_variation5.phpt new file mode 100644 index 00000000..2b86a971 --- /dev/null +++ b/tests/std/strings/chop_variation5.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test chop() function : usage variations - miscellaneous arguments +--FILE-- + +--EXPECT-- +*** Testing chop() : with miscellaneous arguments *** +string(9) "chop test" +string(12) "chop test " +string(17) "chop test " +string(9) "chop test" +string(10) "chop test " +string(9) "chop test" +string(9) "chop test" +string(9) "chop test" +Done diff --git a/tests/std/strings/chr_basic.phpt b/tests/std/strings/chr_basic.phpt new file mode 100644 index 00000000..3ba76ec3 --- /dev/null +++ b/tests/std/strings/chr_basic.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test chr() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing chr() : basic functionality *** +Hello +World diff --git a/tests/std/strings/chr_error.phpt b/tests/std/strings/chr_error.phpt new file mode 100644 index 00000000..0c1d9402 --- /dev/null +++ b/tests/std/strings/chr_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test chr() function : error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +echo "\n-- Testing chr() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +try { + var_dump( chr(72, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +*** Testing chr() : error conditions *** + +-- Testing chr() function with no arguments -- +chr() expects exactly 1 argument, 0 given + +-- Testing chr() function with more than expected no. of arguments -- +chr() expects exactly 1 argument, 2 given diff --git a/tests/std/strings/chr_out_of_range.phpt b/tests/std/strings/chr_out_of_range.phpt new file mode 100644 index 00000000..e0100f09 --- /dev/null +++ b/tests/std/strings/chr_out_of_range.phpt @@ -0,0 +1,19 @@ +--TEST-- +chr() with out of range values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Deprecated: chr(): Providing a value not in-between 0 and 255 is deprecated, this is because a byte value must be in the [0, 255] interval. The value used will be constrained using % 256 in %s on line 3 +bool(true) + +Deprecated: chr(): Providing a value not in-between 0 and 255 is deprecated, this is because a byte value must be in the [0, 255] interval. The value used will be constrained using % 256 in %s on line 4 +bool(true) diff --git a/tests/std/strings/chr_variation1.phpt b/tests/std/strings/chr_variation1.phpt new file mode 100644 index 00000000..fba16b26 --- /dev/null +++ b/tests/std/strings/chr_variation1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test chr() function : usage variations - test values for $ascii argument +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing chr() function: with unexpected inputs for 'ascii' argument *** +-- Iteration 1 -- +string(2) "00" +-- Iteration 2 -- +string(2) "01" +-- Iteration 3 -- +string(2) "ff" +-- Iteration 4 -- + +Deprecated: Implicit conversion from float 10.5 to int loses precision in %s on line %d +string(2) "0a" +-- Iteration 5 -- +string(2) "01" +-- Iteration 6 -- +string(2) "00" diff --git a/tests/std/strings/chunk_split.phpt b/tests/std/strings/chunk_split.phpt new file mode 100644 index 00000000..a2696cd2 --- /dev/null +++ b/tests/std/strings/chunk_split.phpt @@ -0,0 +1,21 @@ +--TEST-- +chunk_split() function +--FILE-- + +--EXPECT-- +a-b-c- +foooo +ooooo +ooooo +oo + +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +test|end diff --git a/tests/std/strings/chunk_split_basic.phpt b/tests/std/strings/chunk_split_basic.phpt new file mode 100644 index 00000000..219e4099 --- /dev/null +++ b/tests/std/strings/chunk_split_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test chunk_split() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : basic functionality *** +-- Testing chunk_split() with all possible arguments -- +string(15) "Te##st##in##g##" +-- Testing chunk_split() with default ending string -- +string(15) "Te +st +in +g +" +-- Testing chunk_split() with default chunklen and ending string -- +string(9) "Testing +" +Done diff --git a/tests/std/strings/chunk_split_variation11.phpt b/tests/std/strings/chunk_split_variation11.phpt new file mode 100644 index 00000000..d4430e9a --- /dev/null +++ b/tests/std/strings/chunk_split_variation11.phpt @@ -0,0 +1,89 @@ +--TEST-- +Test chunk_split() function : usage variations - different strings for 'ending' with heredoc 'str' +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : different values for 'ending' with heredoc 'str'*** +-- Iteration 1 -- +string(113) "This is heredoc string with and +.It also contains +sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char." +-- Iteration 2 -- +string(132) "This i s here doc st ring w ith and +. It als o cont ains +s Peci@! ch@r$ :) & number s 222. This i s \k w rong e scape char. " +-- Iteration 3 -- +string(132) "This ias hereadoc staring waith aand +.aIt alsao contaains +saPeci@!a ch@r$a :) & anumberas 222.aThis ias \k warong eascape achar.a" +-- Iteration 4 -- +string(227) "This iENDINGs hereENDINGdoc stENDINGring wENDINGith ENDINGand +.ENDINGIt alsENDINGo contENDINGains +sENDINGPeci@!ENDING ch@r$ENDING :) & ENDINGnumberENDINGs 222.ENDINGThis iENDINGs \k wENDINGrong eENDINGscape ENDINGchar.ENDING" +-- Iteration 5 -- +string(151) "This i +s here +doc st +ring w +ith +and +. +It als +o cont +ains +s +Peci@! + ch@r$ + :) & +number +s 222. +This i +s \k w +rong e +scape +char. +" +-- Iteration 6 -- +string(170) "This i123s here123doc st123ring w123ith 123and +.123It als123o cont123ains +s123Peci@!123 ch@r$123 :) & 123number123s 222.123This i123s \k w123rong e123scape 123char.123" +-- Iteration 7 -- +string(398) "This i)speci@! ch@r$(s here)speci@! ch@r$(doc st)speci@! ch@r$(ring w)speci@! ch@r$(ith )speci@! ch@r$(and +.)speci@! ch@r$(It als)speci@! ch@r$(o cont)speci@! ch@r$(ains +s)speci@! ch@r$(Peci@!)speci@! ch@r$( ch@r$)speci@! ch@r$( :) & )speci@! ch@r$(number)speci@! ch@r$(s 222.)speci@! ch@r$(This i)speci@! ch@r$(s \k w)speci@! ch@r$(rong e)speci@! ch@r$(scape )speci@! ch@r$(char.)speci@! ch@r$(" +Done diff --git a/tests/std/strings/chunk_split_variation12.phpt b/tests/std/strings/chunk_split_variation12.phpt new file mode 100644 index 00000000..4d7e4a1d --- /dev/null +++ b/tests/std/strings/chunk_split_variation12.phpt @@ -0,0 +1,139 @@ +--TEST-- +Test chunk_split() function : usage variations - different heredoc strings for 'ending' argument +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : different heredoc strings for 'ending' argument *** +-- Iteration 1 -- +string(102) "This is str to check with heredoc ending.This contains, +speci@! ch@r$ __with wrong \k escape char 222." +-- Iteration 2 -- +string(102) "This is str to check with heredoc ending.This contains, +speci@! ch@r$ __with wrong \k escape char 222." +-- Iteration 3 -- +string(113) "This is star to checka with hereadoc endinga.This contaains, +specai@! ch@r$ a__with wroang \k escaape char 22a2.a" +-- Iteration 4 -- +string(421) "This is stThis is simple heredoc stringr to checkThis is simple heredoc string with hereThis is simple heredoc stringdoc endingThis is simple heredoc string.This contThis is simple heredoc stringains, +specThis is simple heredoc stringi@! ch@r$ This is simple heredoc string__with wroThis is simple heredoc stringng \k escaThis is simple heredoc stringpe char 22This is simple heredoc string2.This is simple heredoc string" +-- Iteration 5 -- +string(762) "This is stThis is to check chunk_split +function with multiline +heredocr to checkThis is to check chunk_split +function with multiline +heredoc with hereThis is to check chunk_split +function with multiline +heredocdoc endingThis is to check chunk_split +function with multiline +heredoc.This contThis is to check chunk_split +function with multiline +heredocains, +specThis is to check chunk_split +function with multiline +heredoci@! ch@r$ This is to check chunk_split +function with multiline +heredoc__with wroThis is to check chunk_split +function with multiline +heredocng \k escaThis is to check chunk_split +function with multiline +heredocpe char 22This is to check chunk_split +function with multiline +heredoc2.This is to check chunk_split +function with multiline +heredoc" +-- Iteration 6 -- +string(443) "This is stThis checks with $, %, &, charsr to checkThis checks with $, %, &, chars with hereThis checks with $, %, &, charsdoc endingThis checks with $, %, &, chars.This contThis checks with $, %, &, charsains, +specThis checks with $, %, &, charsi@! ch@r$ This checks with $, %, &, chars__with wroThis checks with $, %, &, charsng \k escaThis checks with $, %, &, charspe char 22This checks with $, %, &, chars2.This checks with $, %, &, chars" +-- Iteration 7 -- +string(487) "This is stThis checks and +white space charsr to checkThis checks and +white space chars with hereThis checks and +white space charsdoc endingThis checks and +white space chars.This contThis checks and +white space charsains, +specThis checks and +white space charsi@! ch@r$ This checks and +white space chars__with wroThis checks and +white space charsng \k escaThis checks and +white space charspe char 22This checks and +white space chars2.This checks and +white space chars" +-- Iteration 8 -- +string(597) "This is st"To check " in heredoc".I'm sure it'll \work!r to check"To check " in heredoc".I'm sure it'll \work! with here"To check " in heredoc".I'm sure it'll \work!doc ending"To check " in heredoc".I'm sure it'll \work!.This cont"To check " in heredoc".I'm sure it'll \work!ains, +spec"To check " in heredoc".I'm sure it'll \work!i@! ch@r$ "To check " in heredoc".I'm sure it'll \work!__with wro"To check " in heredoc".I'm sure it'll \work!ng \k esca"To check " in heredoc".I'm sure it'll \work!pe char 22"To check " in heredoc".I'm sure it'll \work!2."To check " in heredoc".I'm sure it'll \work!" +Done diff --git a/tests/std/strings/chunk_split_variation13.phpt b/tests/std/strings/chunk_split_variation13.phpt new file mode 100644 index 00000000..67b5f055 --- /dev/null +++ b/tests/std/strings/chunk_split_variation13.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test chunk_split() function : usage variations - default 'chunklen' with long string as 'str'argument +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : default 'chunklen' with long string 'str' *** +-- Iteration 0 -- +string(85) "1234567890123456789012345678901234567890123456789012345678901234567890123456 +78901 +" +-- Iteration 1 -- +string(217) "1234567890123456789012345678901234567890123456789012345678901234567890123456 +7890123456789012345678901234567890123456789012345678901234567890123456789012 +34567890123456789012345678901234567890123456789012345678901 +" +Done diff --git a/tests/std/strings/chunk_split_variation1_32bit.phpt b/tests/std/strings/chunk_split_variation1_32bit.phpt new file mode 100644 index 00000000..03a101eb --- /dev/null +++ b/tests/std/strings/chunk_split_variation1_32bit.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 1 *** + +Fatal error: %rAllowed memory size of %d bytes exhausted%s\(tried to allocate %d bytes\)|Possible integer overflow in memory allocation \(4294901777 \+ %d\)%r in %s on line %d diff --git a/tests/std/strings/chunk_split_variation2_32bit.phpt b/tests/std/strings/chunk_split_variation2_32bit.phpt new file mode 100644 index 00000000..c83a37f0 --- /dev/null +++ b/tests/std/strings/chunk_split_variation2_32bit.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 2 *** + +Fatal error: Possible integer overflow in memory allocation (65537 * 65537 + %r65556|65560%r) in %s on line %d diff --git a/tests/std/strings/chunk_split_variation3.phpt b/tests/std/strings/chunk_split_variation3.phpt new file mode 100644 index 00000000..78486a30 --- /dev/null +++ b/tests/std/strings/chunk_split_variation3.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large number of chunks +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 2 *** +Body generation +Using chunk_split() + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/tests/std/strings/chunk_split_variation4.phpt b/tests/std/strings/chunk_split_variation4.phpt new file mode 100644 index 00000000..bd230956 --- /dev/null +++ b/tests/std/strings/chunk_split_variation4.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test chunk_split() function : usage variations - different heredoc strings as 'str' argument +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : heredoc strings as 'str' argument *** +-- Iteration 1 -- +string(2) " +" +-- Iteration 2 -- +string(2) " +" +-- Iteration 3 -- +string(3) "a +" +-- Iteration 4 -- +string(45) "This + is +simp +le h +ered +oc s +trin +g +" +-- Iteration 5 -- +string(90) "This + is +to c +heck + chu +nk_s +plit + +fun +ctio +n wi +th m +ulti +line + +her +edoc +" +-- Iteration 6 -- +string(59) "This + che +cks +here +doc +with + $, +%, & +, ch +ars +" +-- Iteration 7 -- +string(59) "This + che +cks + chu +nk_s +plit +() +E +scap +e +ch +ars +" +-- Iteration 8 -- +string(117) ""To +chec +k " +in h +ered +oc" + +I'm +sure + it' +ll w +ork +also + wit +h \ + +whic +h is + sin +gle +slas +h +" +Done diff --git a/tests/std/strings/chunk_split_variation5.phpt b/tests/std/strings/chunk_split_variation5.phpt new file mode 100644 index 00000000..8f51c001 --- /dev/null +++ b/tests/std/strings/chunk_split_variation5.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test chunk_split() function : usage variations - different integer values for 'chunklen' argument(Bug#42796) +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } catch (\ValueError $e) { + echo $e->getMessage() . "\n"; + } +} + +?> +--EXPECTF-- +*** Testing chunk_split() : different integer values for 'chunklen' *** +-- Iteration 0 -- +chunk_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 1 -- +string(213) "T||h||i||s|| ||c||o||n||t||a||i||n||s|| ||a||n||d|| ||s||p||e||c||i||a||l|| ||c||h||a||r|| ||&|| ||n||u||m||b||e||r||s|| ||1||2||3||.|| +||I||t|| ||a||l||s||o|| ||c||h||e||c||k||s|| ||f||o||r|| ||%0|| ||c||h||a||r||" +-- Iteration 2 -- +chunk_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 3 -- +string(73) "This contains and special char & numbers 123. +It also checks for %0 char||" +-- Iteration 4 -- +string(77) "This contains and special ||char & numbers 123. +It als||o checks for %0 char||" +-- Iteration 5 -- +string(73) "This contains and special char & numbers 123. +It also checks for %0 char||" +-- Iteration 6 -- +chunk_split(): Argument #2 ($length) must be of type int, float given +-- Iteration 7 -- +chunk_split(): Argument #2 ($length) must be greater than 0 diff --git a/tests/std/strings/chunk_split_variation6.phpt b/tests/std/strings/chunk_split_variation6.phpt new file mode 100644 index 00000000..0bf3719d --- /dev/null +++ b/tests/std/strings/chunk_split_variation6.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test chunk_split() function : usage variations - single quoted strings for 'str' argument +--FILE-- + +--EXPECT-- +*** Testing chunk_split() : with different single quoted 'str' *** +-- Iteration 0 -- +string(3) "):(" +-- Iteration 1 -- +string(4) " ):(" +-- Iteration 2 -- +string(30) "This is):( simple):( string):(" +-- Iteration 3 -- +string(35) "It's st):(ring wi):(th quot):(es):(" +-- Iteration 4 -- +string(46) "This co):(ntains ):(@ # $ %):( ^ & ch):(ars):(" +-- Iteration 5 -- +string(59) "This st):(ring\tc):(ontains):(\rwhite):( space\):(nchars):(" +-- Iteration 6 -- +string(47) "This is):( string):( with 1):(234 num):(bers):(" +-- Iteration 7 -- +string(68) "This is):( string):( with \):(0 and "):(.chr(0)):(."null ):(chars):(" +-- Iteration 8 -- +string(74) "This is):( string):( with ):( multi):(ple ):( sp):(ace cha):(r):(" +-- Iteration 9 -- +string(46) "This is):( to che):(ck stri):(ng with):( ()):(" +-- Iteration 10 -- +string(59) " Te):(sting w):(ith ):(multipl):(e space):(s ):(" +-- Iteration 11 -- +string(55) "Testing):( invali):(d \k an):(d \m es):(cape ch):(ar):(" +-- Iteration 12 -- +string(46) "This is):( to che):(ck with):( \n and):( \t):(" +Done diff --git a/tests/std/strings/chunk_split_variation7.phpt b/tests/std/strings/chunk_split_variation7.phpt new file mode 100644 index 00000000..99b8b6c5 --- /dev/null +++ b/tests/std/strings/chunk_split_variation7.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test chunk_split() function : usage variations - different double quoted values for 'str' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : with different double quoted values for 'str' argument *** +-- Iteration 1 -- +string(4) "????" +-- Iteration 2 -- +string(5) " ????" +-- Iteration 3 -- +string(41) "This ????is si????mple ????strin????g????" +-- Iteration 4 -- +string(43) "It's ????strin????g wit????h quo????tes????" +-- Iteration 5 -- +string(59) "This ????conta????ins @???? # $ ????% ^ &???? char????s????" +-- Iteration 6 -- +string(70) "This ????strin????g con????tains???? whit????e spa????ce +ch????ars????" +-- Iteration 7 -- +string(60) "This ????is st????ring ????with ????1234 ????numbe????rs????" +-- Iteration 8 -- +string(69) "This ????is st????ring ????with ????%0 and???? %0nul????l cha????rs????" +-- Iteration 9 -- +string(90) "This ????is st????ring ????with ???? mu????ltipl????e ???? ????space???? char????" +-- Iteration 10 -- +string(69) "Testi????ng in????valid???? \k a????nd \m???? esca????pe ch????ar????" +-- Iteration 11 -- +string(59) "This ????is to???? chec????k wit????h \n ????and \????t????" +Done diff --git a/tests/std/strings/chunk_split_variation8.phpt b/tests/std/strings/chunk_split_variation8.phpt new file mode 100644 index 00000000..b0c88949 --- /dev/null +++ b/tests/std/strings/chunk_split_variation8.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test chunk_split() function : usage variations - different integer values for 'chunklen' with heredoc string as 'str'(Bug#42796) +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } catch (\ValueError $e) { + echo $e->getMessage() . "\n"; + } +} + +?> +--EXPECT-- +*** Testing chunk_split() : different 'chunklen' with heredoc 'str' *** +-- Iteration 1 -- +chunk_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 2 -- +string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: ::: +::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.::: +:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t::: +:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::" +-- Iteration 3 -- +chunk_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 4 -- +string(129) "This's heredoc string with and + white space char. +It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test +chunk_split():::" +-- Iteration 5 -- +string(141) "This's heredoc string with::: and + white space char.::: +It has _speci@l ch@r$ 222:::2 !!!Now \k as escape char::: to test +chunk_split():::" +-- Iteration 6 -- +string(129) "This's heredoc string with and + white space char. +It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test +chunk_split():::" +-- Iteration 7 -- +chunk_split(): Argument #2 ($length) must be of type int, float given +-- Iteration 8 -- +chunk_split(): Argument #2 ($length) must be greater than 0 diff --git a/tests/std/strings/chunk_split_variation9.phpt b/tests/std/strings/chunk_split_variation9.phpt new file mode 100644 index 00000000..821cc8f6 --- /dev/null +++ b/tests/std/strings/chunk_split_variation9.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test chunk_split() function : usage variations - different double quoted strings for 'ending' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : different strings for 'ending' *** +-- Iteration 0 -- +string(56) "This is to test chunk_split() with various ending string" +-- Iteration 1 -- +string(66) "This i s to t est ch unk_sp lit() with v arious endin g stri ng " +-- Iteration 2 -- +string(66) "This ias to taest chaunk_spalit() awith vaariousa endinag strianga" +-- Iteration 3 -- +string(116) "This iENDINGs to tENDINGest chENDINGunk_spENDINGlit() ENDINGwith vENDINGariousENDING endinENDINGg striENDINGngENDING" +-- Iteration 4 -- +string(106) "This i@#$%^s to t@#$%^est ch@#$%^unk_sp@#$%^lit() @#$%^with v@#$%^arious@#$%^ endin@#$%^g stri@#$%^ng@#$%^" +-- Iteration 5 -- +string(66) "This i s to t est ch unk_sp lit() with v arious endin g stri ng " +-- Iteration 6 -- +string(66) "This i +s to t +est ch +unk_sp +lit() +with v +arious + endin +g stri +ng +" +-- Iteration 7 -- +string(66) "This i s to t est ch unk_sp lit() with v arious endin g stri ng " +-- Iteration 8 -- +string(76) "This i +s to t +est ch +unk_sp +lit() +with v +arious + endin +g stri +ng +" +-- Iteration 9 -- +string(66) "This i%0s to t%0est ch%0unk_sp%0lit() %0with v%0arious%0 endin%0g stri%0ng%0" +-- Iteration 10 -- +string(86) "This i123s to t123est ch123unk_sp123lit() 123with v123arious123 endin123g stri123ng123" +-- Iteration 11 -- +string(106) "This i(MSG)s to t(MSG)est ch(MSG)unk_sp(MSG)lit() (MSG)with v(MSG)arious(MSG) endin(MSG)g stri(MSG)ng(MSG)" +-- Iteration 12 -- +string(206) "This i)ending string(s to t)ending string(est ch)ending string(unk_sp)ending string(lit() )ending string(with v)ending string(arious)ending string( endin)ending string(g stri)ending string(ng)ending string(" +-- Iteration 13 -- +string(196) "This i)numbers 1234(s to t)numbers 1234(est ch)numbers 1234(unk_sp)numbers 1234(lit() )numbers 1234(with v)numbers 1234(arious)numbers 1234( endin)numbers 1234(g stri)numbers 1234(ng)numbers 1234(" +-- Iteration 14 -- +string(206) "This i)speci@! ch@r$(s to t)speci@! ch@r$(est ch)speci@! ch@r$(unk_sp)speci@! ch@r$(lit() )speci@! ch@r$(with v)speci@! ch@r$(arious)speci@! ch@r$( endin)speci@! ch@r$(g stri)speci@! ch@r$(ng)speci@! ch@r$(" +Done diff --git a/tests/std/strings/convert_uudecode_basic.phpt b/tests/std/strings/convert_uudecode_basic.phpt new file mode 100644 index 00000000..8f5bd572 --- /dev/null +++ b/tests/std/strings/convert_uudecode_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test convert_uudecode() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing convert_uudecode() : basic functionality *** +TEST PASSED diff --git a/tests/std/strings/convert_uuencode_basic.phpt b/tests/std/strings/convert_uuencode_basic.phpt new file mode 100644 index 00000000..af665ef7 --- /dev/null +++ b/tests/std/strings/convert_uuencode_basic.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test convert_uuencode() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing convert_uuencode() : basic functionality *** +-- Iteration 1 -- +string(8) "#,3(S +` +" +-- Iteration 2 -- +string(8) "#86)C +` +" +-- Iteration 3 -- +string(12) "&,6$R8C-C +` +" +-- Iteration 4 -- +string(82) "M2&5R92!I +--FILE-- + +--EXPECT-- +000000000000000000000000000000001200000000000010000000000000000000000000000000000000000000000000003000120111121083202362220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +121312111121832236222 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + -aeghijklnoprstuvw +1 diff --git a/tests/std/strings/count_chars_basic.phpt b/tests/std/strings/count_chars_basic.phpt new file mode 100644 index 00000000..ccf8cd47 --- /dev/null +++ b/tests/std/strings/count_chars_basic.phpt @@ -0,0 +1,1572 @@ +--TEST-- +Test count_chars() function : basic functionality +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +*** Testing count_chars() : basic functionality *** +array(256) { + [0]=> + int(0) + [1]=> + int(0) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(0) + [7]=> + int(0) + [8]=> + int(0) + [9]=> + int(0) + [10]=> + int(0) + [11]=> + int(0) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(7) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(1) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(5) + [98]=> + int(1) + [99]=> + int(2) + [100]=> + int(1) + [101]=> + int(3) + [102]=> + int(1) + [103]=> + int(1) + [104]=> + int(1) + [105]=> + int(4) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(1) + [110]=> + int(5) + [111]=> + int(3) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(5) + [115]=> + int(3) + [116]=> + int(5) + [117]=> + int(3) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(0) +} +array(256) { + [0]=> + int(0) + [1]=> + int(0) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(0) + [7]=> + int(0) + [8]=> + int(0) + [9]=> + int(0) + [10]=> + int(0) + [11]=> + int(0) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(7) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(1) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(5) + [98]=> + int(1) + [99]=> + int(2) + [100]=> + int(1) + [101]=> + int(3) + [102]=> + int(1) + [103]=> + int(1) + [104]=> + int(1) + [105]=> + int(4) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(1) + [110]=> + int(5) + [111]=> + int(3) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(5) + [115]=> + int(3) + [116]=> + int(5) + [117]=> + int(3) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(0) +} +array(18) { + [32]=> + int(7) + [82]=> + int(1) + [97]=> + int(5) + [98]=> + int(1) + [99]=> + int(2) + [100]=> + int(1) + [101]=> + int(3) + [102]=> + int(1) + [103]=> + int(1) + [104]=> + int(1) + [105]=> + int(4) + [109]=> + int(1) + [110]=> + int(5) + [111]=> + int(3) + [114]=> + int(5) + [115]=> + int(3) + [116]=> + int(5) + [117]=> + int(3) +} +array(238) { + [0]=> + int(0) + [1]=> + int(0) + [2]=> + int(0) + [3]=> + int(0) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(0) + [7]=> + int(0) + [8]=> + int(0) + [9]=> + int(0) + [10]=> + int(0) + [11]=> + int(0) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(0) +} +string(18) " Rabcdefghimnorstu" +string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" +count_chars(): Argument #2 ($mode) must be between 0 and 4 (inclusive) diff --git a/tests/std/strings/crc32.phpt b/tests/std/strings/crc32.phpt new file mode 100644 index 00000000..da86d067 --- /dev/null +++ b/tests/std/strings/crc32.phpt @@ -0,0 +1,42 @@ +--TEST-- +crc32() function +--FILE-- + +--EXPECT-- +2356372769 +1996459178 +2015626392 +824412087 +509595063 +1890929711 +156217630 +941689929 +1939457775 +2213121284 +522627406 +3806880586 +105010221 +1135881371 +640556525 +3081003972 +3751918510 +1076024698 diff --git a/tests/std/strings/crc32_basic.phpt b/tests/std/strings/crc32_basic.phpt new file mode 100644 index 00000000..6452fe7d --- /dev/null +++ b/tests/std/strings/crc32_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test crc32() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing crc32() : basic functionality *** +bool(true) +256895812 +Done diff --git a/tests/std/strings/crc32_variation2.phpt b/tests/std/strings/crc32_variation2.phpt new file mode 100644 index 00000000..b4e12adf --- /dev/null +++ b/tests/std/strings/crc32_variation2.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test crc32() function : usage variations - single quoted strings +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing crc32() : with different strings in single quotes *** + +-- Iteration 1 -- +int(0) + +-- Iteration 2 -- +int(-378745019) + +-- Iteration 3 -- +int(222957957) + +-- Iteration 4 -- +int(-2015000997) + +-- Iteration 5 -- +int(1234261835) + +-- Iteration 6 -- +int(-1867296214) + +-- Iteration 7 -- +int(1048577080) + +-- Iteration 8 -- +int(2129739710) + +-- Iteration 9 -- +int(-1633247628) + +-- Iteration 10 -- +int(135755572) + +-- Iteration 11 -- +int(27384015) + +-- Iteration 12 -- +int(-497244052) + +-- Iteration 13 -- +int(-2065897232) + +-- Iteration 14 -- +int(243585859) + +-- Iteration 15 -- +int(-856440615) + +-- Iteration 16 -- +int(647088397) + +-- Iteration 17 -- +int(523630053) + +-- Iteration 18 -- +int(-2062229676) + +-- Iteration 19 -- +int(1169918910) + +-- Iteration 20 -- +int(-618551732) + +-- Iteration 21 -- +int(-1828940657) + +-- Iteration 22 -- +int(-1654468652) + +-- Iteration 23 -- +int(-1648442217) + +-- Iteration 24 -- +int(1431761713) +Done diff --git a/tests/std/strings/crc32_variation3.phpt b/tests/std/strings/crc32_variation3.phpt new file mode 100644 index 00000000..1f5905f3 --- /dev/null +++ b/tests/std/strings/crc32_variation3.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test crc32() function : usage variations - double quoted strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing crc32() : with different strings in double quotes *** + +Warning: Undefined variable $hello in %s on line %d + +Warning: Undefined variable $world in %s on line %d + +-- Iteration 1 -- +int(0) + +-- Iteration 2 -- +int(-378745019) + +-- Iteration 3 -- +int(222957957) + +-- Iteration 4 -- +int(-2015000997) + +-- Iteration 5 -- +int(1234261835) + +-- Iteration 6 -- +int(-1867296214) + +-- Iteration 7 -- +int(1048577080) + +-- Iteration 8 -- +int(2129739710) + +-- Iteration 9 -- +int(-1633247628) + +-- Iteration 10 -- +int(1191242624) + +-- Iteration 11 -- +int(603128807) + +-- Iteration 12 -- +int(-525789576) + +-- Iteration 13 -- +int(770262395) + +-- Iteration 14 -- +int(243585859) + +-- Iteration 15 -- +int(-986324846) + +-- Iteration 16 -- +int(-102031187) + +-- Iteration 17 -- +int(-588181215) + +-- Iteration 18 -- +int(-1417857067) + +-- Iteration 19 -- +int(523630053) + +-- Iteration 20 -- +int(-503915034) + +-- Iteration 21 -- +int(-254912432) + +-- Iteration 22 -- +int(-1581578467) + +-- Iteration 23 -- +int(-1828940657) + +-- Iteration 24 -- +int(-1654468652) + +-- Iteration 25 -- +int(0) + +-- Iteration 26 -- +int(1431761713) +Done diff --git a/tests/std/strings/crc32_variation4.phpt b/tests/std/strings/crc32_variation4.phpt new file mode 100644 index 00000000..d4a6ae56 --- /dev/null +++ b/tests/std/strings/crc32_variation4.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test crc32() function : usage variations - heredoc strings +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing crc32() : with different heredoc strings *** + +-- Iteration 1 -- +int(0) + +-- Iteration 2 -- +int(1541608299) + +-- Iteration 3 -- +int(1588851550) + +-- Iteration 4 -- +int(-1726108239) + +-- Iteration 5 -- +int(-1847303891) + +-- Iteration 6 -- +int(-1260053120) + +-- Iteration 7 -- +int(-1718044186) + +-- Iteration 8 -- +int(1646793751) +Done diff --git a/tests/std/strings/crypt.phpt b/tests/std/strings/crypt.phpt new file mode 100644 index 00000000..26e6e6eb --- /dev/null +++ b/tests/std/strings/crypt.phpt @@ -0,0 +1,37 @@ +--TEST-- +crypt() function +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +STD +EXT +MD5 +BLO +crypt() expects exactly 2 arguments, 1 given diff --git a/tests/std/strings/crypt_blowfish.phpt b/tests/std/strings/crypt_blowfish.phpt new file mode 100644 index 00000000..a8eda721 --- /dev/null +++ b/tests/std/strings/crypt_blowfish.phpt @@ -0,0 +1,104 @@ +--TEST-- +Official blowfish tests (http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/glibc/crypt_blowfish/wrapper.c) +--FILE-- + +--EXPECT-- +0. OK +1. OK +2. OK +3. OK +4. OK +5. OK +6. OK +7. OK +8. OK +9. OK +10. OK +11. OK +12. OK +13. OK +14. OK +15. OK +16. OK +17. OK +18. OK +19. OK +20. OK +21. OK +22. OK +23. OK +24. OK +25. OK +26. OK +27. OK +28. OK +29. OK +30. OK +31. OK +32. OK +33. OK +34. OK diff --git a/tests/std/strings/crypt_blowfish_variation1.phpt b/tests/std/strings/crypt_blowfish_variation1.phpt new file mode 100644 index 00000000..5cfdbcfb --- /dev/null +++ b/tests/std/strings/crypt_blowfish_variation1.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test Blowfish crypt() with invalid rounds +--FILE-- + '$2a$32$CCCCCCCCCCCCCCCCCCCCCC$', + '33' => '$2a$33$CCCCCCCCCCCCCCCCCCCCCC$', + '34' => '$2a$34$CCCCCCCCCCCCCCCCCCCCCC$', + '35' => '$2a$35$CCCCCCCCCCCCCCCCCCCCCC$', + '36' => '$2a$36$CCCCCCCCCCCCCCCCCCCCCC$', + '37' => '$2a$37$CCCCCCCCCCCCCCCCCCCCCC$', + '38' => '$2a$38$CCCCCCCCCCCCCCCCCCCCCC$',); + +foreach($salts as $i=>$salt) { + $crypt = crypt('U*U', $salt); + if ($crypt === '*0' || $crypt === '*1') { + echo "$i. OK\n"; + } else { + echo "$i. Not OK\n"; + } +} + +?> +--EXPECT-- +32. OK +33. OK +34. OK +35. OK +36. OK +37. OK +38. OK diff --git a/tests/std/strings/crypt_blowfish_variation2.phpt b/tests/std/strings/crypt_blowfish_variation2.phpt new file mode 100644 index 00000000..f354a8ec --- /dev/null +++ b/tests/std/strings/crypt_blowfish_variation2.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test Blowfish crypt() does not fall back to DES when rounds are not specified, +or Blowfish is not available. +--FILE-- + +--EXPECT-- +OK diff --git a/tests/std/strings/crypt_chars.phpt b/tests/std/strings/crypt_chars.phpt new file mode 100644 index 00000000..c0ef4a39 --- /dev/null +++ b/tests/std/strings/crypt_chars.phpt @@ -0,0 +1,14 @@ +--TEST-- +crypt() function - characters > 0x80 +--FILE-- + +--EXPECT-- +string(13) "99PxawtsTfX56" +string(13) "99jcVcGxUZOWk" +string(20) "_01234567IBjxKliXXRQ" +string(20) "_012345678OSGpGQRVHA" diff --git a/tests/std/strings/crypt_des_error.phpt b/tests/std/strings/crypt_des_error.phpt new file mode 100644 index 00000000..6c77ccd9 --- /dev/null +++ b/tests/std/strings/crypt_des_error.phpt @@ -0,0 +1,10 @@ +--TEST-- +crypt(): *0 should return *1 +--FILE-- + +--EXPECT-- +string(2) "*1" diff --git a/tests/std/strings/crypt_sha256.phpt b/tests/std/strings/crypt_sha256.phpt new file mode 100644 index 00000000..32424829 --- /dev/null +++ b/tests/std/strings/crypt_sha256.phpt @@ -0,0 +1,60 @@ +--TEST-- +crypt() SHA-256 +--FILE-- + array( + '$5$saltstring', + 'Hello world!', + '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5' + ), + 2 => array( + '$5$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' + ), + 3 => array( + '$5$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA' + ), + 4 => array( + '$5$rounds=5000$toolongsaltstring', + 'This is just a test', + '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5' + ), + 5 => array( + '$5$rounds=1400$anotherlongsaltstring', + 'a very much longer text to encrypt. This one even stretches over morethan one line.', + '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1' + ), + 6 => array( + '$5$rounds=77777$short', + 'we have a short salt string but not a short password', + '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/' + ), + 7 => array( + '$5$rounds=123456$asaltof16chars..', + 'a short string', + '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD' + ), + + // The "too many rounds" behavior depends on the crypt() + // implementation, but for now everyone agrees on what to do. + 8 => array( + '$5$rounds=1000000000$roundstoohigh', + 'the number of rounds is too high', + '*0' + ) +); + +foreach ($tests as $iter => $t) { + $res = crypt($t[1], $t[0]); + if ($res != $t[2]) echo "Iteration $iter failed. +Expected: <$t[2]> +Got <$res>\n"; +} +echo "Passes.";?> +--EXPECT-- +Passes. diff --git a/tests/std/strings/crypt_sha512.phpt b/tests/std/strings/crypt_sha512.phpt new file mode 100644 index 00000000..77431777 --- /dev/null +++ b/tests/std/strings/crypt_sha512.phpt @@ -0,0 +1,63 @@ +--TEST-- +crypt() SHA-512 +--FILE-- + array( + '$6$saltstring', + 'Hello world!', + '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1' + ), + 2 => array( + '$6$rounds=10000$saltstringsaltstring', + 'Hello world!', + '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.' + ), + 3 => array( + '$6$rounds=5000$toolongsaltstring', + 'This is just a test', + '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0' + ), + 4 => array( + '$6$rounds=1400$anotherlongsaltstring', + 'a very much longer text to encrypt. This one even stretches over morethan one line.', + '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1' + ), + 5 => array( + '$6$rounds=77777$short', + 'we have a short salt string but not a short password', + '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0' + ), + 6 => array( + '$6$rounds=123456$asaltof16chars..', + 'a short string', + '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1' + ), + 7 => array( + '$6$$bar$', + 'foo', + '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.' + ), + 8 => array( + '$6$rounds=10$roundstoolow', + 'the number of rounds is too low', + '*0' + ), + 8 => array( + '$6$rounds=1000000000$roundstoohigh', + 'the number of rounds is too high', + '*0' + ), +); + +foreach ($tests as $iter => $t) { + $res = crypt($t[1], $t[0]); + if ($res != $t[2]) echo "Iteration $iter failed. +Expected: <$t[2]> +Got <$res>\n"; +} +echo "Passes."; +?> +--EXPECT-- +Passes. diff --git a/tests/std/strings/crypt_variation1.phpt b/tests/std/strings/crypt_variation1.phpt new file mode 100644 index 00000000..3f351a6d --- /dev/null +++ b/tests/std/strings/crypt_variation1.phpt @@ -0,0 +1,17 @@ +--TEST-- +crypt() function - long salt +--FILE-- + +--EXPECT-- +$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6 +$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6 +$5$AAAAAAAAAAAAAAAA$frotiiztWZiwcncxnY5tWG9Ida2WOZEximjLXCleQu6 diff --git a/tests/std/strings/default_charset.phpt b/tests/std/strings/default_charset.phpt new file mode 100644 index 00000000..3a8e2696 --- /dev/null +++ b/tests/std/strings/default_charset.phpt @@ -0,0 +1,104 @@ +--TEST-- +default_charset and htmlentities/htmlspecialchars/html_entity_decode +--INI-- +default_charset=UTF-8 +internal_encoding= +input_encoding= +output_encoding= +--FILE-- + +--EXPECT-- +*** Default php.ini value *** +string(5) "UTF-8" +string(0) "" +string(0) "" +string(0) "" +*** Runtime change of default_charset *** +string(5) "UTF-8" +*** Test with updated default_charset *** +string(6) "cp1252" +string(0) "" +string(0) "" +string(0) "" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +*** Change internal_encoding to empty *** +string(0) "" +string(6) "cp1252" +string(0) "" +string(0) "" +string(0) "" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +*** Update input/output_encoding *** +string(0) "" +string(0) "" +string(6) "cp1252" +string(0) "" +string(10) "ISO-8859-1" +string(10) "ISO-8859-1" +string(7) "£" +string(7) "£" +string(2) "a3" +string(2) "a3" +Done diff --git a/tests/std/strings/dirname_basic.phpt b/tests/std/strings/dirname_basic.phpt new file mode 100644 index 00000000..4509e4e2 --- /dev/null +++ b/tests/std/strings/dirname_basic.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test dirname() function : basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECTREGEX-- +\*\*\* Testing basic operations \*\*\* + +--Iteration 1 -- +string\(1\) "." + +--Iteration 2 -- +string\(4\) "(\\|\/)foo" + +--Iteration 3 -- +string\(3\) "foo" + +--Iteration 4 -- +string\(1\) "(\\|\/)" + +--Iteration 5 -- +string\(1\) "." + +--Iteration 6 -- +string\(1\) "(\\|\/)" + +--Iteration 7 -- +string\(4\) "(\\|\/)foo" + +--Iteration 8 -- +string\(3\) "foo" + +--Iteration 9 -- +string\(1\) "(\\|\/)" + +--Iteration 10 -- +string\(4\) "(\\|\/)foo" + +--Iteration 11 -- +string\(3\) "foo" + +--Iteration 12 -- +string\(1\) "." + +--Iteration 13 -- +string\(1\) "." + +--Iteration 14 -- +string\(1\) "(\\|\/)" + +--Iteration 15 -- +string\(1\) "(\\|\/)" + +--Iteration 16 -- +string\(4\) "(\\|\/)foo" + +--Iteration 17 -- +string\(3\) "foo" + +--Iteration 18 -- +string\(1\) "(\\|\/)" + +--Iteration 19 -- +string\(1\) "(\\|\/)" + +--Iteration 20 -- +string\(1\) "." + +--Iteration 21 -- +string\(4\) "(\\|\/)foo" + +--Iteration 22 -- +string\(1\) "." + +--Iteration 23 -- +string\(4\) "(\\|\/)foo" + +--Iteration 24 -- +string\(3\) "foo" + +--Iteration 25 -- +string\(1\) "." + +--Iteration 26 -- +string\(1\) "(\\|\/)" + +--Iteration 27 -- +string\(1\) "(\\|\/)" + +--Iteration 28 -- +string\(1\) "." + +--Iteration 29 -- +string\(8\) "(\\|\/)foo\x00bar" +Done diff --git a/tests/std/strings/dirname_error.phpt b/tests/std/strings/dirname_error.phpt new file mode 100644 index 00000000..39888867 --- /dev/null +++ b/tests/std/strings/dirname_error.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test dirname() function : error conditions +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} + +?> +--EXPECT-- +*** Testing error conditions *** +dirname(): Argument #2 ($levels) must be greater than or equal to 1 diff --git a/tests/std/strings/dirname_multi.phpt b/tests/std/strings/dirname_multi.phpt new file mode 100644 index 00000000..5518380c --- /dev/null +++ b/tests/std/strings/dirname_multi.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test dirname() function : usage variations +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } +} +var_dump(dirname("/foo/bar/baz", PHP_INT_MAX)); +?> +--EXPECT-- +dirname(): Argument #2 ($levels) must be greater than or equal to 1 +string(8) "/foo/bar" +string(4) "/foo" +string(1) "/" +string(1) "/" +string(1) "/" diff --git a/tests/std/strings/dirname_multi_win.phpt b/tests/std/strings/dirname_multi_win.phpt new file mode 100644 index 00000000..fa1f307a --- /dev/null +++ b/tests/std/strings/dirname_multi_win.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test dirname() function : usage variations +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } +} + +var_dump(dirname("/foo/bar/baz", PHP_INT_MAX)); +var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX)); +var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX)); +?> +--EXPECT-- +dirname(): Argument #2 ($levels) must be greater than or equal to 1 +string(8) "/foo/bar" +string(4) "/foo" +string(1) "\" +string(1) "\" +string(1) "\" +string(3) "g:\" +string(3) "g:." diff --git a/tests/std/strings/dirname_variation.phpt b/tests/std/strings/dirname_variation.phpt new file mode 100644 index 00000000..355a4d8d --- /dev/null +++ b/tests/std/strings/dirname_variation.phpt @@ -0,0 +1,136 @@ +--TEST-- +Test dirname() function : usage variations +--SKIPIF-- + +--FILE-- + +--EXPECTREGEX-- +\*\*\* Testing possible variations in path \*\*\* + +--Iteration 1 -- +string\(11\) "~(\\|\/)home(\\|\/)user" + +--Iteration 2 -- +string\(11\) "~(\\|\/)home(\\|\/)user" + +--Iteration 3 -- +string\(11\) "~(\\|\/)home(\\|\/)user" + +--Iteration 4 -- +string\(11\) "~(\\|\/)home(\\|\/)user" + +--Iteration 5 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 6 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 7 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 8 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 9 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 10 -- +string\(19\) "hostname:(\\|\/)home(\\|\/)user" + +--Iteration 11 -- +string\(1\) "." + +--Iteration 12 -- +string\(1\) "(\\|\/)" + +--Iteration 13 -- +string\(1\) "(\\|\/)" + +--Iteration 14 -- +string\(1\) "." + +--Iteration 15 -- +string\(2\) "10" + +--Iteration 16 -- +string\(1\) "." + +--Iteration 17 -- +string\(1\) "." + +--Iteration 18 -- +string\(1\) "." + +--Iteration 19 -- +string\(1\) "." + +--Iteration 20 -- +string\(1\) "." + +--Iteration 21 -- +string\(0\) "" + +--Iteration 22 -- +string\(0\) "" +Done diff --git a/tests/std/strings/explode.phpt b/tests/std/strings/explode.phpt new file mode 100644 index 00000000..1f8cd742 --- /dev/null +++ b/tests/std/strings/explode.phpt @@ -0,0 +1,188 @@ +--TEST-- +explode() function +--INI-- +error_reporting=2047 +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +try { + var_dump(explode("", NULL)); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump(explode(NULL, "")); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +var_dump(explode("a", "")); +var_dump(explode("a", "a")); +var_dump(explode("a", NULL)); +try { + var_dump(explode(NULL, "a")); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +var_dump(explode("abc", "acb")); +var_dump(explode("somestring", "otherstring")); +var_dump(explode("somestring", "otherstring", -1)); +var_dump(explode("a", "aaaaaa")); +var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10))); +var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10))); +////////////////////////////////////// +var_dump(explode(":","a lazy dog:jumps:over:",-1)); +var_dump(explode(":","a lazy dog:jumps:over", -1)); +var_dump(explode(":","a lazy dog:jumps:over", -2)); +var_dump(explode(":","a lazy dog:jumps:over:",-4)); +var_dump(explode(":","a lazy dog:jumps:over:",-40000000000000)); +var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1)); +var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2)); +?> +--EXPECT-- +array ( + 0 => 'a', + 1 => 'b' . "\0" . 'd', + 2 => 'f', + 3 => '1', + 4 => 'd', +) +d6bee42a771449205344c0938ad4f035 +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +array(1) { + [0]=> + string(0) "" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(0) "" +} +array(1) { + [0]=> + string(0) "" +} +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +array(1) { + [0]=> + string(3) "acb" +} +array(1) { + [0]=> + string(11) "otherstring" +} +array(0) { +} +array(7) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" +} +array(1) { + [0]=> + string(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-" +} +array(21) { + [0]=> + string(1) "-" + [1]=> + string(2) "48" + [2]=> + string(2) "--" + [3]=> + string(2) "48" + [4]=> + string(2) "--" + [5]=> + string(2) "48" + [6]=> + string(2) "--" + [7]=> + string(2) "48" + [8]=> + string(2) "--" + [9]=> + string(2) "48" + [10]=> + string(2) "--" + [11]=> + string(2) "48" + [12]=> + string(2) "--" + [13]=> + string(2) "48" + [14]=> + string(2) "--" + [15]=> + string(2) "48" + [16]=> + string(2) "--" + [17]=> + string(2) "48" + [18]=> + string(2) "--" + [19]=> + string(2) "48" + [20]=> + string(1) "-" +} +array(3) { + [0]=> + string(10) "a lazy dog" + [1]=> + string(5) "jumps" + [2]=> + string(4) "over" +} +array(2) { + [0]=> + string(10) "a lazy dog" + [1]=> + string(5) "jumps" +} +array(1) { + [0]=> + string(10) "a lazy dog" +} +array(0) { +} +array(0) { +} +array(2) { + [0]=> + string(10) "a lazy dog" + [1]=> + string(11) "jumps::over" +} +array(1) { + [0]=> + string(10) "a lazy dog" +} diff --git a/tests/std/strings/explode1.phpt b/tests/std/strings/explode1.phpt new file mode 100644 index 00000000..e68c08aa --- /dev/null +++ b/tests/std/strings/explode1.phpt @@ -0,0 +1,484 @@ +--TEST-- +Test explode() function +--SKIPIF-- + +--INI-- +error_reporting=2047 +precision=14 +--FILE-- +getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 0) ); + } catch (\ValueError $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 1) ); + } catch (\ValueError $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 2) ); + } catch (\ValueError $e) { + echo $e->getMessage() . "\n"; + } + $counter++; +} + +echo "\n*** Testing explode() with miscellaneous input arguments ***\n"; + +echo "\n-- Passing positive values of Limit to explode() --\n"; +/* LIMIT=2 */ +var_dump( explode("::", "mon::tues::wed::thurs::fri::sat::sun", 2) ); + +/* checking for LIMIT =0,1 */ +echo "\n-- Passing limit values 0 and 1 to explode() --\n"; +var_dump( explode(":", "Name:Phone:Address:City:State", 0) ); +var_dump( explode(":", "Name:Phone:Address:City:State", 1) ); + +/* to check the maximum limit of string that can be given with limit<=0, + default size is 50 but increases dynamically */ +echo "\n*** Testing explode() for maximum limit of string with Limit = -1 ***\n"; +var_dump( explode(":", "1:2:3:4:5:6:7:7:5:6:7:3:4:5:2:8:9:0:5:5:5:5:5:5:5:5:5:5:5:5:55:5:5:5%:%:%:%:5:5:5:%:%:5:5:5:5:5%:%:%:55:1:1", -1) ); + +echo "\n*** Testing explode() with string variations as input argument ***\n"; +/* String with escape characters */ +echo "\n-- Testing string with escape characters --\n"; +var_dump( explode("\t\n", "1234\t\n5678\n\t9100") ); +var_dump( explode("\r", "1234\rabcd\r5678\rrstu") ); + +/* String with embedded NULL */ +echo "\n-- Testing string with embedded NULL --\n"; +var_dump( explode("\x00", "abcd\x0n1234\x0005678\x0000efgh\xijkl") ); +var_dump( explode("\0", "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\000yz") ); + +/* Checking OBJECTS type */ +echo "\n*** Testing explode() with objects ***\n"; +class string1 { + public function __toString() { + return "Object"; + } +} +$obj = new string1; +var_dump( explode("b", $obj) ); + +?> +--EXPECT-- +*** Testing explode() for basic operations *** +-- Iteration 1 -- +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +-- Iteration 2 -- +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +-- Iteration 3 -- +array(1) { + [0]=> + string(10) "1234NULL23" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(10) "1234NULL23" + [1]=> + string(43) "00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +-- Iteration 4 -- +array(5) { + [0]=> + string(14) "1234NULL23abcd" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(14) "1234NULL23abcd" + [1]=> + string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +-- Iteration 5 -- +array(5) { + [0]=> + string(14) "1234NULL23abcd" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(14) "1234NULL23abcd" + [1]=> + string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +-- Iteration 6 -- +array(5) { + [0]=> + string(0) "" + [1]=> + string(28) "234NULL23abcd00000TRUEFALSE-" + [2]=> + string(0) "" + [3]=> + string(12) ".234444true-" + [4]=> + string(0) "" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +-- Iteration 7 -- +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +explode(): Argument #1 ($separator) must not be empty, use str_split() to split a string into characters +-- Iteration 8 -- +array(2) { + [0]=> + string(28) "1234NULL23abcd00000TRUEFALSE" + [1]=> + string(12) "1.234444true" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(28) "1234NULL23abcd00000TRUEFALSE" + [1]=> + string(27) "1.234444true-11.24%PHP%ZEND" +} +-- Iteration 9 -- +array(1) { + [0]=> + string(28) "1234NULL23abcd00000TRUEFALSE" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(28) "1234NULL23abcd00000TRUEFALSE" + [1]=> + string(23) "4444true-11.24%PHP%ZEND" +} +-- Iteration 10 -- +array(6) { + [0]=> + string(3) "123" + [1]=> + string(30) "NULL23abcd00000TRUEFALSE-11.23" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(9) "true-11.2" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(3) "123" + [1]=> + string(53) "NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +-- Iteration 11 -- +array(2) { + [0]=> + string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24" + [1]=> + string(3) "PHP" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(1) { + [0]=> + string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" +} +array(2) { + [0]=> + string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24" + [1]=> + string(8) "PHP%ZEND" +} + +*** Testing explode() with miscellaneous input arguments *** + +-- Passing positive values of Limit to explode() -- +array(2) { + [0]=> + string(3) "mon" + [1]=> + string(31) "tues::wed::thurs::fri::sat::sun" +} + +-- Passing limit values 0 and 1 to explode() -- +array(1) { + [0]=> + string(29) "Name:Phone:Address:City:State" +} +array(1) { + [0]=> + string(29) "Name:Phone:Address:City:State" +} + +*** Testing explode() for maximum limit of string with Limit = -1 *** +array(51) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" + [5]=> + string(1) "6" + [6]=> + string(1) "7" + [7]=> + string(1) "7" + [8]=> + string(1) "5" + [9]=> + string(1) "6" + [10]=> + string(1) "7" + [11]=> + string(1) "3" + [12]=> + string(1) "4" + [13]=> + string(1) "5" + [14]=> + string(1) "2" + [15]=> + string(1) "8" + [16]=> + string(1) "9" + [17]=> + string(1) "0" + [18]=> + string(1) "5" + [19]=> + string(1) "5" + [20]=> + string(1) "5" + [21]=> + string(1) "5" + [22]=> + string(1) "5" + [23]=> + string(1) "5" + [24]=> + string(1) "5" + [25]=> + string(1) "5" + [26]=> + string(1) "5" + [27]=> + string(1) "5" + [28]=> + string(1) "5" + [29]=> + string(1) "5" + [30]=> + string(2) "55" + [31]=> + string(1) "5" + [32]=> + string(1) "5" + [33]=> + string(2) "5%" + [34]=> + string(1) "%" + [35]=> + string(1) "%" + [36]=> + string(1) "%" + [37]=> + string(1) "5" + [38]=> + string(1) "5" + [39]=> + string(1) "5" + [40]=> + string(1) "%" + [41]=> + string(1) "%" + [42]=> + string(1) "5" + [43]=> + string(1) "5" + [44]=> + string(1) "5" + [45]=> + string(1) "5" + [46]=> + string(2) "5%" + [47]=> + string(1) "%" + [48]=> + string(1) "%" + [49]=> + string(2) "55" + [50]=> + string(1) "1" +} + +*** Testing explode() with string variations as input argument *** + +-- Testing string with escape characters -- +array(2) { + [0]=> + string(4) "1234" + [1]=> + string(10) "5678 + 9100" +} +array(4) { + [0]=> + string(4) "1234" + [1]=> + string(4) "abcd" + [2]=> + string(4) "5678" + [3]=> + string(4) "rstu" +} + +-- Testing string with embedded NULL -- +array(4) { + [0]=> + string(4) "abcd" + [1]=> + string(5) "n1234" + [2]=> + string(5) "05678" + [3]=> + string(12) "00efgh\xijkl" +} +array(7) { + [0]=> + string(4) "abcd" + [1]=> + string(4) "efgh" + [2]=> + string(4) "ijkl" + [3]=> + string(4) "mnop" + [4]=> + string(5) "0qrst" + [5]=> + string(4) "uvwx" + [6]=> + string(2) "yz" +} + +*** Testing explode() with objects *** +array(2) { + [0]=> + string(1) "O" + [1]=> + string(4) "ject" +} diff --git a/tests/std/strings/explode_bug.phpt b/tests/std/strings/explode_bug.phpt new file mode 100644 index 00000000..22d92ea7 --- /dev/null +++ b/tests/std/strings/explode_bug.phpt @@ -0,0 +1,15 @@ +--TEST-- +Explode/memnstr bug +--INI-- +error_reporting=2047 +memory_limit=256M +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(1) "1" +} diff --git a/tests/std/strings/explode_variation4.phpt b/tests/std/strings/explode_variation4.phpt new file mode 100644 index 00000000..988f31ea --- /dev/null +++ b/tests/std/strings/explode_variation4.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test explode() function : usage variations - match longer string +--FILE-- + +--EXPECT-- +*** Testing explode() function: match longer string *** +array(7) { + [0]=> + string(6) "piece1" + [1]=> + string(5) "iece2" + [2]=> + string(5) "iece3" + [3]=> + string(5) "iece4" + [4]=> + string(5) "iece5" + [5]=> + string(5) "iece6" + [6]=> + string(0) "" +} diff --git a/tests/std/strings/explode_variation5.phpt b/tests/std/strings/explode_variation5.phpt new file mode 100644 index 00000000..7d825b95 --- /dev/null +++ b/tests/std/strings/explode_variation5.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test explode() function : usage variations - positive and negative limits +--FILE-- + +--EXPECT-- +*** Testing explode() function: positive and negative limits *** + +-- positive limit -- +array(2) { + [0]=> + string(3) "one" + [1]=> + string(16) "two||three||four" +} + +-- negative limit (since PHP 5.1) -- +array(3) { + [0]=> + string(3) "one" + [1]=> + string(3) "two" + [2]=> + string(5) "three" +} + +-- negative limit (since PHP 5.1) with null string -- +array(0) { +} diff --git a/tests/std/strings/explode_variation6.phpt b/tests/std/strings/explode_variation6.phpt new file mode 100644 index 00000000..3ac8d3ce --- /dev/null +++ b/tests/std/strings/explode_variation6.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test explode() function : usage variations - misc tests +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing explode() function: misc tests *** + +-- positive limit with null separator -- +string(6) "6f6e65" +string(28) "74776f00746872656500666f7572" + +-- negative limit (since PHP 5.1) with null separator -- +string(6) "6f6e65" +string(6) "74776f" + +-- unknown string -- +string(36) "6f6e650074776f00746872656500666f7572" + +-- limit = 0 -- +string(36) "6f6e650074776f00746872656500666f7572" + +-- limit = -1 -- +string(6) "6f6e65" +string(6) "74776f" +string(10) "7468726565" + +-- large limit = -100 -- +string(6) "6f6e65" +string(6) "74776f" +string(10) "7468726565" +string(8) "666f7572" diff --git a/tests/std/strings/explode_variation7.phpt b/tests/std/strings/explode_variation7.phpt new file mode 100644 index 00000000..683afd9c --- /dev/null +++ b/tests/std/strings/explode_variation7.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test explode() function : usage variations - when $string length is greater than +EXPLODE_ALLOC_STEP (64) and the $limit is negative +--CREDITS-- +edgarsandi - +--FILE-- + +--EXPECT-- +int(64) diff --git a/tests/std/strings/fprintf_error.phpt b/tests/std/strings/fprintf_error.phpt new file mode 100644 index 00000000..a6ddcdd9 --- /dev/null +++ b/tests/std/strings/fprintf_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test fprintf() function (errors) +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +/* scalar argument */ +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +/* NULL argument */ +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +echo "Done\n"; +?> +--EXPECT-- +*** Testing Error Conditions *** +fprintf() expects at least 2 arguments, 0 given +fprintf() expects at least 2 arguments, 1 given +fprintf() expects at least 2 arguments, 1 given +Done diff --git a/tests/std/strings/fprintf_variation_001.phpt b/tests/std/strings/fprintf_variation_001.phpt new file mode 100644 index 00000000..c010aef3 --- /dev/null +++ b/tests/std/strings/fprintf_variation_001.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test fprintf() function (variation - 1) +--FILE-- + +--EXPECT-- +*** Testing fprintf() with floats *** + +-- Iteration 1 -- + +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +-- Iteration 2 -- + +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +-- Iteration 3 -- + ++0.000000 ++1.000000 +-1.000000 ++0.320000 +-0.320000 ++3.400000 ++2.540000 +-2.540000 +-- Iteration 4 -- + + 0.00 + 1.00 + -1.00 + 0.32 + -0.32 + 3.40 + 2.54 + -2.54 +-- Iteration 5 -- + +0.00 +1.00 +-1.00 +0.32 +-0.32 +3.40 +2.54 +-2.54 +-- Iteration 6 -- + +0000.00 +0001.00 +-001.00 +0000.32 +-000.32 +0003.40 +0002.54 +-002.54 +-- Iteration 7 -- + +0.00000 +1.00000 +-1.0000 +0.32000 +-0.3200 +3.40000 +2.54000 +-2.5400 +-- Iteration 8 -- + +###0.00 +###1.00 +##-1.00 +###0.32 +##-0.32 +###3.40 +###2.54 +##-2.54 +Done diff --git a/tests/std/strings/fprintf_variation_002.phpt b/tests/std/strings/fprintf_variation_002.phpt new file mode 100644 index 00000000..f0f21b46 --- /dev/null +++ b/tests/std/strings/fprintf_variation_002.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test fprintf() function (variation - 2) +--FILE-- + +--EXPECT-- +*** Testing fprintf() with integers *** + +-- Iteration 1 -- + +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 +-- Iteration 2 -- + +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 +-- Iteration 3 -- + ++0 ++1 +-1 ++2 +-2 ++23333333 +-23333333 ++1234 +-- Iteration 4 -- + + 0 + 1 + -1 + 2 + -2 +23333333 +-23333333 + 1234 +-- Iteration 5 -- + +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 +-- Iteration 6 -- + +0000000 +0000001 +-000001 +0000002 +-000002 +23333333 +-23333333 +0001234 +-- Iteration 7 -- + +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 +-- Iteration 8 -- + +######0 +######1 +#####-1 +######2 +#####-2 +23333333 +-23333333 +###1234 +Done diff --git a/tests/std/strings/fprintf_variation_003.phpt b/tests/std/strings/fprintf_variation_003.phpt new file mode 100644 index 00000000..9e977937 --- /dev/null +++ b/tests/std/strings/fprintf_variation_003.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 3) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() with binary *** + +0 +1 +11111111111111111111111111111111 +10 +11111111111111111111111111111110 +1011001000000100111010101 +11111110100110111111011000101011 +10011010010 +Done diff --git a/tests/std/strings/fprintf_variation_003_64bit.phpt b/tests/std/strings/fprintf_variation_003_64bit.phpt new file mode 100644 index 00000000..bdb59d50 --- /dev/null +++ b/tests/std/strings/fprintf_variation_003_64bit.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 3) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() with binary *** + +0 +1 +1111111111111111111111111111111111111111111111111111111111111111 +10 +1111111111111111111111111111111111111111111111111111111111111110 +1011001000000100111010101 +1111111111111111111111111111111111111110100110111111011000101011 +10011010010 +Done diff --git a/tests/std/strings/fprintf_variation_004.phpt b/tests/std/strings/fprintf_variation_004.phpt new file mode 100644 index 00000000..a72f46b3 --- /dev/null +++ b/tests/std/strings/fprintf_variation_004.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test fprintf() function (variation - 4) +--FILE-- + +--EXPECTF-- +*** Testing fprintf() for chars *** + +%0 +%0 +C +%s +c +Done diff --git a/tests/std/strings/fprintf_variation_005.phpt b/tests/std/strings/fprintf_variation_005.phpt new file mode 100644 index 00000000..ddc4f709 --- /dev/null +++ b/tests/std/strings/fprintf_variation_005.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test fprintf() function (variation - 5) +--FILE-- + +--EXPECT-- +*** Testing fprintf() for scientific type *** + +0.000000e+0 +1.000000e+0 +-1.000000e+0 +2.700000e+0 +-2.700000e+0 +2.333333e+7 +-2.333333e+7 +1.234000e+3 +Done diff --git a/tests/std/strings/fprintf_variation_006.phpt b/tests/std/strings/fprintf_variation_006.phpt new file mode 100644 index 00000000..75846c27 --- /dev/null +++ b/tests/std/strings/fprintf_variation_006.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 6) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for unsigned integers *** + +0 +1 +4294967295 +2 +4294967294 +23333333 +4271633963 +1234 +Done diff --git a/tests/std/strings/fprintf_variation_006_64bit.phpt b/tests/std/strings/fprintf_variation_006_64bit.phpt new file mode 100644 index 00000000..a4c20f16 --- /dev/null +++ b/tests/std/strings/fprintf_variation_006_64bit.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 6) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for unsigned integers *** + +0 +1 +18446744073709551615 +2 +18446744073709551614 +23333333 +18446744073686218283 +1234 +Done diff --git a/tests/std/strings/fprintf_variation_007.phpt b/tests/std/strings/fprintf_variation_007.phpt new file mode 100644 index 00000000..e2102a53 --- /dev/null +++ b/tests/std/strings/fprintf_variation_007.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 7) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for octals *** + +0 +1 +37777777777 +2 +37777777776 +131004725 +37646773053 +2322 +Done diff --git a/tests/std/strings/fprintf_variation_007_64bit.phpt b/tests/std/strings/fprintf_variation_007_64bit.phpt new file mode 100644 index 00000000..b4c80f95 --- /dev/null +++ b/tests/std/strings/fprintf_variation_007_64bit.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test fprintf() function (variation - 7) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for octals *** + +0 +1 +1777777777777777777777 +2 +1777777777777777777776 +131004725 +1777777777777646773053 +2322 +Done diff --git a/tests/std/strings/fprintf_variation_008.phpt b/tests/std/strings/fprintf_variation_008.phpt new file mode 100644 index 00000000..dba49b47 --- /dev/null +++ b/tests/std/strings/fprintf_variation_008.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test fprintf() function (variation - 8) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for hexadecimals *** + +0 +1 +ffffffff +2 +fffffffe +16409d5 +fe9bf62b +4d2 +Done diff --git a/tests/std/strings/fprintf_variation_008_64bit.phpt b/tests/std/strings/fprintf_variation_008_64bit.phpt new file mode 100644 index 00000000..fae1ce3c --- /dev/null +++ b/tests/std/strings/fprintf_variation_008_64bit.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test fprintf() function (variation - 8) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing fprintf() for hexadecimals *** + +0 +1 +ffffffffffffffff +2 +fffffffffffffffe +16409d5 +fffffffffe9bf62b +4d2 +Done diff --git a/tests/std/strings/fprintf_variation_009.phpt b/tests/std/strings/fprintf_variation_009.phpt new file mode 100644 index 00000000..eb1780f0 --- /dev/null +++ b/tests/std/strings/fprintf_variation_009.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test fprintf() function (variation - 9) +--FILE-- + +--EXPECT-- +*** Testing fprintf() for string types *** + +-- Iteration 1 -- + + + abc + aaa +-- Iteration 2 -- + + +abc +aaa +-- Iteration 3 -- + +00000 +00abc +00aaa +-- Iteration 4 -- + +##### +##abc +##aaa +Done diff --git a/tests/std/strings/get_html_translation_table_basic1.phpt b/tests/std/strings/get_html_translation_table_basic1.phpt new file mode 100644 index 00000000..4f4920c7 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic1.phpt @@ -0,0 +1,544 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - with default args +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality *** +-- with table = HTML_ENTITIES -- +array(252) { + ["Æ"]=> + string(7) "Æ" + ["Ã"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Ã…"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Î’"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ã"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Ã"]=> + string(8) "Í" + ["ÃŽ"]=> + string(7) "Î" + ["ÃŒ"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ã"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Î"]=> + string(4) "Ν" + ["Å’"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ã’"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Å "]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Î¥"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ã"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["Ã¥"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["Æ’"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["â„"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["â„‘"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["â‡"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["â†"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["â—Š"]=> + string(5) "◊" + ["‎"]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["Å“"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["Ï€"]=> + string(4) "π" + ["Ï–"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["âˆ"]=> + string(6) "∏" + ["âˆ"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["""]=> + string(6) """ + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["â€"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["Ï"]=> + string(5) "ρ" + ["â€"]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["Å¡"]=> + string(8) "š" + ["â‹…"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + ["­"]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["Ï‚"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["â™ "]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["Ï„"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["Ï‘"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["Ëœ"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["â„¢"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["Ï’"]=> + string(7) "ϒ" + ["Ï…"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["Â¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + ["â€"]=> + string(5) "‍" + ["‌"]=> + string(6) "‌" +} +-- with table = HTML_SPECIALCHARS -- +array(4) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic10.phpt b/tests/std/strings/get_html_translation_table_basic10.phpt new file mode 100644 index 00000000..848d8930 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic10.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test get_html_translation_table() function: htmlentities/HTML 4/ISO-8859-1 (bug #64011) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(100) +Array +( + ["] => " + [&] => & + [<] => < + [>] => > + [ ] =>   + [¡] => ¡ + [¢] => ¢ + [£] => £ + [¤] => ¤ + [¥] => ¥ + [¦] => ¦ + [§] => § + [¨] => ¨ + [©] => © + [ª] => ª + [«] => « + [¬] => ¬ + [­] => ­ + [®] => ® + [¯] => ¯ + [°] => ° + [±] => ± + [²] => ² + [³] => ³ + [´] => ´ + [µ] => µ + [¶] => ¶ + [·] => · + [¸] => ¸ + [¹] => ¹ + [º] => º + [»] => » + [¼] => ¼ + [½] => ½ + [¾] => ¾ + [¿] => ¿ + [À] => À + [Á] => Á + [Â] =>  + [Ã] => à + [Ä] => Ä + [Å] => Å + [Æ] => Æ + [Ç] => Ç + [È] => È + [É] => É + [Ê] => Ê + [Ë] => Ë + [Ì] => Ì + [Í] => Í + [Î] => Î + [Ï] => Ï + [Ð] => Ð + [Ñ] => Ñ + [Ò] => Ò + [Ó] => Ó + [Ô] => Ô + [Õ] => Õ + [Ö] => Ö + [×] => × + [Ø] => Ø + [Ù] => Ù + [Ú] => Ú + [Û] => Û + [Ü] => Ü + [Ý] => Ý + [Þ] => Þ + [ß] => ß + [à] => à + [á] => á + [â] => â + [ã] => ã + [ä] => ä + [å] => å + [æ] => æ + [ç] => ç + [è] => è + [é] => é + [ê] => ê + [ë] => ë + [ì] => ì + [í] => í + [î] => î + [ï] => ï + [ð] => ð + [ñ] => ñ + [ò] => ò + [ó] => ó + [ô] => ô + [õ] => õ + [ö] => ö + [÷] => ÷ + [ø] => ø + [ù] => ù + [ú] => ú + [û] => û + [ü] => ü + [ý] => ý + [þ] => þ + [ÿ] => ÿ +) +Done diff --git a/tests/std/strings/get_html_translation_table_basic2.phpt b/tests/std/strings/get_html_translation_table_basic2.phpt new file mode 100644 index 00000000..df61096a --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic2.phpt @@ -0,0 +1,1560 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - table as HTML_ENTITIES & diff quote_style +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality *** +-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT -- +array(252) { + ["Æ"]=> + string(7) "Æ" + ["Ã"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Ã…"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Î’"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ã"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Ã"]=> + string(8) "Í" + ["ÃŽ"]=> + string(7) "Î" + ["ÃŒ"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ã"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Î"]=> + string(4) "Ν" + ["Å’"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ã’"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Å "]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Î¥"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ã"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["Ã¥"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["Æ’"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["â„"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["â„‘"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["â‡"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["â†"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["â—Š"]=> + string(5) "◊" + ["‎"]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["Å“"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["Ï€"]=> + string(4) "π" + ["Ï–"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["âˆ"]=> + string(6) "∏" + ["âˆ"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["""]=> + string(6) """ + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["â€"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["Ï"]=> + string(5) "ρ" + ["â€"]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["Å¡"]=> + string(8) "š" + ["â‹…"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + ["­"]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["Ï‚"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["â™ "]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["Ï„"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["Ï‘"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["Ëœ"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["â„¢"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["Ï’"]=> + string(7) "ϒ" + ["Ï…"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["Â¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + ["â€"]=> + string(5) "‍" + ["‌"]=> + string(6) "‌" +} +-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES -- +array(253) { + ["'"]=> + string(6) "'" + ["Æ"]=> + string(7) "Æ" + ["Ã"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Ã…"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Î’"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ã"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Ã"]=> + string(8) "Í" + ["ÃŽ"]=> + string(7) "Î" + ["ÃŒ"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ã"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Î"]=> + string(4) "Ν" + ["Å’"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ã’"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Å "]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Î¥"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ã"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["Ã¥"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["Æ’"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["â„"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["â„‘"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["â‡"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["â†"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["â—Š"]=> + string(5) "◊" + ["‎"]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["Å“"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["Ï€"]=> + string(4) "π" + ["Ï–"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["âˆ"]=> + string(6) "∏" + ["âˆ"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["""]=> + string(6) """ + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["â€"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["Ï"]=> + string(5) "ρ" + ["â€"]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["Å¡"]=> + string(8) "š" + ["â‹…"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + ["­"]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["Ï‚"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["â™ "]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["Ï„"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["Ï‘"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["Ëœ"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["â„¢"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["Ï’"]=> + string(7) "ϒ" + ["Ï…"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["Â¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + ["â€"]=> + string(5) "‍" + ["‌"]=> + string(6) "‌" +} +-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES -- +array(251) { + ["Æ"]=> + string(7) "Æ" + ["Ã"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Α"]=> + string(7) "Α" + ["Ã…"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Î’"]=> + string(6) "Β" + ["Ç"]=> + string(8) "Ç" + ["Χ"]=> + string(5) "Χ" + ["‡"]=> + string(8) "‡" + ["Δ"]=> + string(7) "Δ" + ["Ã"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ε"]=> + string(9) "Ε" + ["Η"]=> + string(5) "Η" + ["Ë"]=> + string(6) "Ë" + ["Γ"]=> + string(7) "Γ" + ["Ã"]=> + string(8) "Í" + ["ÃŽ"]=> + string(7) "Î" + ["ÃŒ"]=> + string(8) "Ì" + ["Ι"]=> + string(6) "Ι" + ["Ã"]=> + string(6) "Ï" + ["Κ"]=> + string(7) "Κ" + ["Λ"]=> + string(8) "Λ" + ["Μ"]=> + string(4) "Μ" + ["Ñ"]=> + string(8) "Ñ" + ["Î"]=> + string(4) "Ν" + ["Å’"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ã’"]=> + string(8) "Ò" + ["Ω"]=> + string(7) "Ω" + ["Ο"]=> + string(9) "Ο" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Φ"]=> + string(5) "Φ" + ["Π"]=> + string(4) "Π" + ["″"]=> + string(7) "″" + ["Ψ"]=> + string(5) "Ψ" + ["Ρ"]=> + string(5) "Ρ" + ["Å "]=> + string(8) "Š" + ["Σ"]=> + string(7) "Σ" + ["Þ"]=> + string(7) "Þ" + ["Τ"]=> + string(5) "Τ" + ["Θ"]=> + string(7) "Θ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Î¥"]=> + string(9) "Υ" + ["Ü"]=> + string(6) "Ü" + ["Ξ"]=> + string(4) "Ξ" + ["Ã"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["Ζ"]=> + string(6) "Ζ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["ℵ"]=> + string(9) "ℵ" + ["α"]=> + string(7) "α" + ["&"]=> + string(5) "&" + ["∧"]=> + string(5) "∧" + ["∠"]=> + string(5) "∠" + ["Ã¥"]=> + string(7) "å" + ["≈"]=> + string(7) "≈" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["β"]=> + string(6) "β" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["∩"]=> + string(5) "∩" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["χ"]=> + string(5) "χ" + ["ˆ"]=> + string(6) "ˆ" + ["♣"]=> + string(7) "♣" + ["≅"]=> + string(6) "≅" + ["©"]=> + string(6) "©" + ["↵"]=> + string(7) "↵" + ["∪"]=> + string(5) "∪" + ["¤"]=> + string(8) "¤" + ["⇓"]=> + string(6) "⇓" + ["†"]=> + string(8) "†" + ["↓"]=> + string(6) "↓" + ["°"]=> + string(5) "°" + ["δ"]=> + string(7) "δ" + ["♦"]=> + string(7) "♦" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["∅"]=> + string(7) "∅" + [" "]=> + string(6) " " + [" "]=> + string(6) " " + ["ε"]=> + string(9) "ε" + ["≡"]=> + string(7) "≡" + ["η"]=> + string(5) "η" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["∃"]=> + string(7) "∃" + ["Æ’"]=> + string(6) "ƒ" + ["∀"]=> + string(8) "∀" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + ["â„"]=> + string(7) "⁄" + ["γ"]=> + string(7) "γ" + ["≥"]=> + string(4) "≥" + [">"]=> + string(4) ">" + ["⇔"]=> + string(6) "⇔" + ["↔"]=> + string(6) "↔" + ["♥"]=> + string(8) "♥" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["â„‘"]=> + string(7) "ℑ" + ["∞"]=> + string(7) "∞" + ["∫"]=> + string(5) "∫" + ["ι"]=> + string(6) "ι" + ["¿"]=> + string(8) "¿" + ["∈"]=> + string(6) "∈" + ["ï"]=> + string(6) "ï" + ["κ"]=> + string(7) "κ" + ["â‡"]=> + string(6) "⇐" + ["λ"]=> + string(8) "λ" + ["〈"]=> + string(6) "⟨" + ["«"]=> + string(7) "«" + ["â†"]=> + string(6) "←" + ["⌈"]=> + string(7) "⌈" + ["“"]=> + string(7) "“" + ["≤"]=> + string(4) "≤" + ["⌊"]=> + string(8) "⌊" + ["∗"]=> + string(8) "∗" + ["â—Š"]=> + string(5) "◊" + ["‎"]=> + string(5) "‎" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + ["−"]=> + string(7) "−" + ["μ"]=> + string(4) "μ" + ["∇"]=> + string(7) "∇" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["≠"]=> + string(4) "≠" + ["∋"]=> + string(4) "∋" + ["¬"]=> + string(5) "¬" + ["∉"]=> + string(7) "∉" + ["⊄"]=> + string(6) "⊄" + ["ñ"]=> + string(8) "ñ" + ["ν"]=> + string(4) "ν" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["Å“"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["‾"]=> + string(7) "‾" + ["ω"]=> + string(7) "ω" + ["ο"]=> + string(9) "ο" + ["⊕"]=> + string(7) "⊕" + ["∨"]=> + string(4) "∨" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["⊗"]=> + string(8) "⊗" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["∂"]=> + string(6) "∂" + ["‰"]=> + string(8) "‰" + ["⊥"]=> + string(6) "⊥" + ["φ"]=> + string(5) "φ" + ["Ï€"]=> + string(4) "π" + ["Ï–"]=> + string(5) "ϖ" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["′"]=> + string(7) "′" + ["âˆ"]=> + string(6) "∏" + ["âˆ"]=> + string(6) "∝" + ["ψ"]=> + string(5) "ψ" + ["⇒"]=> + string(6) "⇒" + ["√"]=> + string(7) "√" + ["〉"]=> + string(6) "⟩" + ["»"]=> + string(7) "»" + ["→"]=> + string(6) "→" + ["⌉"]=> + string(7) "⌉" + ["â€"]=> + string(7) "”" + ["ℜ"]=> + string(6) "ℜ" + ["®"]=> + string(5) "®" + ["⌋"]=> + string(8) "⌋" + ["Ï"]=> + string(5) "ρ" + ["â€"]=> + string(5) "‏" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["Å¡"]=> + string(8) "š" + ["â‹…"]=> + string(6) "⋅" + ["§"]=> + string(6) "§" + ["­"]=> + string(5) "­" + ["σ"]=> + string(7) "σ" + ["Ï‚"]=> + string(8) "ς" + ["∼"]=> + string(5) "∼" + ["â™ "]=> + string(8) "♠" + ["⊂"]=> + string(5) "⊂" + ["⊆"]=> + string(6) "⊆" + ["∑"]=> + string(5) "∑" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["⊃"]=> + string(5) "⊃" + ["⊇"]=> + string(6) "⊇" + ["ß"]=> + string(7) "ß" + ["Ï„"]=> + string(5) "τ" + ["∴"]=> + string(8) "∴" + ["θ"]=> + string(7) "θ" + ["Ï‘"]=> + string(10) "ϑ" + [" "]=> + string(8) " " + ["þ"]=> + string(7) "þ" + ["Ëœ"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["â„¢"]=> + string(7) "™" + ["⇑"]=> + string(6) "⇑" + ["ú"]=> + string(8) "ú" + ["↑"]=> + string(6) "↑" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["Ï’"]=> + string(7) "ϒ" + ["Ï…"]=> + string(9) "υ" + ["ü"]=> + string(6) "ü" + ["℘"]=> + string(8) "℘" + ["ξ"]=> + string(4) "ξ" + ["ý"]=> + string(8) "ý" + ["Â¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" + ["ζ"]=> + string(6) "ζ" + ["â€"]=> + string(5) "‍" + ["‌"]=> + string(6) "‌" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic3.phpt b/tests/std/strings/get_html_translation_table_basic3.phpt new file mode 100644 index 00000000..0927bd44 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic3.phpt @@ -0,0 +1,66 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality *** +-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT -- +array(4) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES -- +array(5) { + ["'"]=> + string(6) "'" + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic4.phpt b/tests/std/strings/get_html_translation_table_basic4.phpt new file mode 100644 index 00000000..136c9df6 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic4.phpt @@ -0,0 +1,287 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - charset WINDOWS-1252 +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality/Windows-1252 *** +-- with table = HTML_ENTITIES -- +array(125) { + ["Æ"]=> + string(7) "Æ" + ["Á"]=> + string(8) "Á" + ["Â"]=> + string(7) "Â" + ["À"]=> + string(8) "À" + ["Å"]=> + string(7) "Å" + ["Ã"]=> + string(8) "Ã" + ["Ä"]=> + string(6) "Ä" + ["Ç"]=> + string(8) "Ç" + ["‡"]=> + string(8) "‡" + ["Ð"]=> + string(5) "Ð" + ["É"]=> + string(8) "É" + ["Ê"]=> + string(7) "Ê" + ["È"]=> + string(8) "È" + ["Ë"]=> + string(6) "Ë" + ["Í"]=> + string(8) "Í" + ["Î"]=> + string(7) "Î" + ["Ì"]=> + string(8) "Ì" + ["Ï"]=> + string(6) "Ï" + ["Ñ"]=> + string(8) "Ñ" + ["Œ"]=> + string(7) "Œ" + ["Ó"]=> + string(8) "Ó" + ["Ô"]=> + string(7) "Ô" + ["Ò"]=> + string(8) "Ò" + ["Ø"]=> + string(8) "Ø" + ["Õ"]=> + string(8) "Õ" + ["Ö"]=> + string(6) "Ö" + ["Š"]=> + string(8) "Š" + ["Þ"]=> + string(7) "Þ" + ["Ú"]=> + string(8) "Ú" + ["Û"]=> + string(7) "Û" + ["Ù"]=> + string(8) "Ù" + ["Ü"]=> + string(6) "Ü" + ["Ý"]=> + string(8) "Ý" + ["Ÿ"]=> + string(6) "Ÿ" + ["á"]=> + string(8) "á" + ["â"]=> + string(7) "â" + ["´"]=> + string(7) "´" + ["æ"]=> + string(7) "æ" + ["à"]=> + string(8) "à" + ["&"]=> + string(5) "&" + ["å"]=> + string(7) "å" + ["ã"]=> + string(8) "ã" + ["ä"]=> + string(6) "ä" + ["„"]=> + string(7) "„" + ["¦"]=> + string(8) "¦" + ["•"]=> + string(6) "•" + ["ç"]=> + string(8) "ç" + ["¸"]=> + string(7) "¸" + ["¢"]=> + string(6) "¢" + ["ˆ"]=> + string(6) "ˆ" + ["©"]=> + string(6) "©" + ["¤"]=> + string(8) "¤" + ["†"]=> + string(8) "†" + ["°"]=> + string(5) "°" + ["÷"]=> + string(8) "÷" + ["é"]=> + string(8) "é" + ["ê"]=> + string(7) "ê" + ["è"]=> + string(8) "è" + ["ð"]=> + string(5) "ð" + ["ë"]=> + string(6) "ë" + ["€"]=> + string(6) "€" + ["ƒ"]=> + string(6) "ƒ" + ["½"]=> + string(8) "½" + ["¼"]=> + string(8) "¼" + ["¾"]=> + string(8) "¾" + [">"]=> + string(4) ">" + ["…"]=> + string(8) "…" + ["í"]=> + string(8) "í" + ["î"]=> + string(7) "î" + ["¡"]=> + string(7) "¡" + ["ì"]=> + string(8) "ì" + ["¿"]=> + string(8) "¿" + ["ï"]=> + string(6) "ï" + ["«"]=> + string(7) "«" + ["“"]=> + string(7) "“" + ["‹"]=> + string(8) "‹" + ["‘"]=> + string(7) "‘" + ["<"]=> + string(4) "<" + ["¯"]=> + string(6) "¯" + ["—"]=> + string(7) "—" + ["µ"]=> + string(7) "µ" + ["·"]=> + string(8) "·" + [" "]=> + string(6) " " + ["–"]=> + string(7) "–" + ["¬"]=> + string(5) "¬" + ["ñ"]=> + string(8) "ñ" + ["ó"]=> + string(8) "ó" + ["ô"]=> + string(7) "ô" + ["œ"]=> + string(7) "œ" + ["ò"]=> + string(8) "ò" + ["ª"]=> + string(6) "ª" + ["º"]=> + string(6) "º" + ["ø"]=> + string(8) "ø" + ["õ"]=> + string(8) "õ" + ["ö"]=> + string(6) "ö" + ["¶"]=> + string(6) "¶" + ["‰"]=> + string(8) "‰" + ["±"]=> + string(8) "±" + ["£"]=> + string(7) "£" + ["""]=> + string(6) """ + ["»"]=> + string(7) "»" + ["”"]=> + string(7) "”" + ["®"]=> + string(5) "®" + ["›"]=> + string(8) "›" + ["’"]=> + string(7) "’" + ["‚"]=> + string(7) "‚" + ["š"]=> + string(8) "š" + ["§"]=> + string(6) "§" + ["­"]=> + string(5) "­" + ["¹"]=> + string(6) "¹" + ["²"]=> + string(6) "²" + ["³"]=> + string(6) "³" + ["ß"]=> + string(7) "ß" + ["þ"]=> + string(7) "þ" + ["˜"]=> + string(7) "˜" + ["×"]=> + string(7) "×" + ["™"]=> + string(7) "™" + ["ú"]=> + string(8) "ú" + ["û"]=> + string(7) "û" + ["ù"]=> + string(8) "ù" + ["¨"]=> + string(5) "¨" + ["ü"]=> + string(6) "ü" + ["ý"]=> + string(8) "ý" + ["¥"]=> + string(5) "¥" + ["ÿ"]=> + string(6) "ÿ" +} +-- with table = HTML_SPECIALCHARS -- +array(4) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic5.phpt b/tests/std/strings/get_html_translation_table_basic5.phpt new file mode 100644 index 00000000..86f19f3a --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic5.phpt @@ -0,0 +1,1599 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - HTML 5 +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality/HTML 5 *** +-- with table = HTML_ENTITIES, ENT_COMPAT -- +int(1510) +Array +( + [Æ] => Æ + [Ã] => Á + [Ä‚] => Ă + [Â] =>  + [Ð] => А + [ð”„] => 𝔄 + [À] => À + [Α] => Α + [Ä€] => Ā + [â©“] => ⩓ + [Ä„] => Ą + [ð”¸] => 𝔸 + [Ã…] => Å + [ð’œ] => 𝒜 + [Ã] => à + [Ä] => Ä + [â«§] => ⫧ + [Б] => Б + [∵] => ∵ + [Î’] => Β + [ð”…] => 𝔅 + [ð”¹] => 𝔹 + [˘] => ˘ + [ℬ] => ℬ + [Ч] => Ч + [Ć] => Ć + [â‹’] => ⋒ + [â……] => ⅅ + [ÄŒ] => Č + [Ç] => Ç + [Ĉ] => Ĉ + [∰] => ∰ + [ÄŠ] => Ċ + [¸] => ¸ + [·] => · + [â„­] => ℭ + [Χ] => Χ + [⊙] => ⊙ + [⊕] => ⊕ + [⊗] => ⊗ + [∷] => ∷ + [â©´] => ⩴ + [≡] => ≡ + [∮] => ∮ + [âˆ] => ∐ + [⨯] => ⨯ + [ð’ž] => 𝒞 + [â‹“] => ⋓ + [â‰] => ≍ + [⤑] => ⤑ + [Ђ] => Ђ + [Ð…] => Ѕ + [Ð] => Џ + [‡] => ‡ + [↡] => ↡ + [⫤] => ⫤ + [ÄŽ] => Ď + [Д] => Д + [Δ] => Δ + [ð”‡] => 𝔇 + [´] => ´ + [Ë] => ˝ + [Ëœ] => ˜ + [â…†] => ⅆ + [ð”»] => 𝔻 + [⃜] => ⃜ + [∯] => ∯ + [¨] => ¨ + [â‡] => ⇐ + [⟹] => ⟹ + [⊨] => ⊨ + [⇑] => ⇑ + [⤓] => ⤓ + [⇵] => ⇵ + [Ì‘] => ̑ + [â¥] => ⥐ + [⥞] => ⥞ + [⥖] => ⥖ + [⥟] => ⥟ + [⥗] => ⥗ + [⊤] => ⊤ + [↧] => ↧ + [⇓] => ⇓ + [ð’Ÿ] => 𝒟 + [Ä] => Đ + [ÅŠ] => Ŋ + [Ã] => Ð + [É] => É + [Äš] => Ě + [Ê] => Ê + [Э] => Э + [Ä–] => Ė + [ð”ˆ] => 𝔈 + [È] => È + [Ä’] => Ē + [â—»] => ◻ + [â–«] => ▫ + [Ę] => Ę + [ð”¼] => 𝔼 + [Ε] => Ε + [⩵] => ⩵ + [⩳] => ⩳ + [Η] => Η + [Ë] => Ë + [∃] => ∃ + [Ф] => Ф + [ð”‰] => 𝔉 + [â—¼] => ◼ + [ð”½] => 𝔽 + [ℱ] => ℱ + [Ѓ] => Ѓ + [Γ] => Γ + [Ïœ] => Ϝ + [Äž] => Ğ + [Ä¢] => Ģ + [Äœ] => Ĝ + [Г] => Г + [Ä ] => Ġ + [ð”Š] => 𝔊 + [â‹™] => ⋙ + [ð”¾] => 𝔾 + [⪢] => ⪢ + [≳] => ≳ + [ð’¢] => 𝒢 + [Ъ] => Ъ + [ˇ] => ˇ + [^] => ^ + [Ĥ] => Ĥ + [ℌ] => ℌ + [â„‹] => ℋ + [â„] => ℍ + [─] => ─ + [Ħ] => Ħ + [â‰] => ≏ + [Е] => Е + [IJ] => IJ + [Ð] => Ё + [Ã] => Í + [ÃŽ] => Î + [И] => И + [İ] => İ + [â„‘] => ℑ + [ÃŒ] => Ì + [Ī] => Ī + [â…ˆ] => ⅈ + [⇒] => ⇒ + [∬] => ∬ + [∫] => ∫ + [â¢] => ⁢ + [Ä®] => Į + [ð•€] => 𝕀 + [Ι] => Ι + [Ĩ] => Ĩ + [І] => І + [Ã] => Ï + [Ä´] => Ĵ + [Й] => Й + [ð”] => 𝔍 + [ð•] => 𝕁 + [ð’¥] => 𝒥 + [Ј] => Ј + [Є] => Є + [Ð¥] => Х + [ÐŒ] => Ќ + [Κ] => Κ + [Ķ] => Ķ + [К] => К + [ð”Ž] => 𝔎 + [ð•‚] => 𝕂 + [ð’¦] => 𝒦 + [Љ] => Љ + [Ĺ] => Ĺ + [Λ] => Λ + [⟪] => ⟪ + [↞] => ↞ + [Ľ] => Ľ + [Ä»] => Ļ + [Л] => Л + [⇤] => ⇤ + [⟦] => ⟦ + [⥡] => ⥡ + [⥙] => ⥙ + [⌊] => ⌊ + [⥎] => ⥎ + [↤] => ↤ + [⥚] => ⥚ + [â§] => ⧏ + [⊴] => ⊴ + [⥑] => ⥑ + [⥠] => ⥠ + [⥘] => ⥘ + [⥒] => ⥒ + [⪡] => ⪡ + [≲] => ≲ + [ð”] => 𝔏 + [⋘] => ⋘ + [Ä¿] => Ŀ + [⟷] => ⟷ + [⟶] => ⟶ + [ð•ƒ] => 𝕃 + [↘] => ↘ + [↰] => ↰ + [Å] => Ł + [⤅] => ⤅ + [М] => М + [âŸ] =>   + [ℳ] => ℳ + [ð”] => 𝔐 + [∓] => ∓ + [ð•„] => 𝕄 + [Μ] => Μ + [Њ] => Њ + [Ń] => Ń + [Ň] => Ň + [Å…] => Ņ + [Ð] => Н + [ +] => + [ð”‘] => 𝔑 + [â ] => ⁠ + [⫬] => ⫬ + [≢] => ≢ + [≭] => ≭ + [≠] => ≠ + [≧̸] => ≧̸ + [≫̸] => ≫̸ + [≹] => ≹ + [â§Ì¸] => ⧏̸ + [≮] => ≮ + [≰] => ≰ + [⪢̸] => ⪢̸ + [⪡̸] => ⪡̸ + [⪯̸] => ⪯̸ + [â‹ ] => ⋠ + [â§Ì¸] => ⧐̸ + [â‹­] => ⋭ + [âŠÌ¸] => ⊏̸ + [â‹¢] => ⋢ + [âŠÌ¸] => ⊐̸ + [â‹£] => ⋣ + [⊈] => ⊈ + [âŠ] => ⊁ + [⪰̸] => ⪰̸ + [â‹¡] => ⋡ + [≿̸] => ≿̸ + [⊉] => ⊉ + [â‰] => ≁ + [ð’©] => 𝒩 + [Ñ] => Ñ + [Î] => Ν + [Å’] => Œ + [Ó] => Ó + [Ô] => Ô + [О] => О + [Å] => Ő + [ð”’] => 𝔒 + [Ã’] => Ò + [ÅŒ] => Ō + [Ω] => Ω + [Ο] => Ο + [ð•†] => 𝕆 + [“] => “ + [‘] => ‘ + [â©”] => ⩔ + [ð’ª] => 𝒪 + [Ø] => Ø + [Õ] => Õ + [⨷] => ⨷ + [Ö] => Ö + [âž] => ⏞ + [⎴] => ⎴ + [âœ] => ⏜ + [П] => П + [ð”“] => 𝔓 + [Φ] => Φ + [Π] => Π + [⪻] => ⪻ + [≼] => ≼ + [″] => ″ + [ð’«] => 𝒫 + [Ψ] => Ψ + [ð””] => 𝔔 + [ð’¬] => 𝒬 + [Å”] => Ŕ + [⟫] => ⟫ + [⤖] => ⤖ + [Ř] => Ř + [Å–] => Ŗ + [Р] => Р + [∋] => ∋ + [⥯] => ⥯ + [ℜ] => ℜ + [Ρ] => Ρ + [⟩] => ⟩ + [⇥] => ⇥ + [⌉] => ⌉ + [⟧] => ⟧ + [â¥] => ⥝ + [⇂] => ⇂ + [⥕] => ⥕ + [⌋] => ⌋ + [⥛] => ⥛ + [â§] => ⧐ + [⊵] => ⊵ + [â¥] => ⥏ + [⥜] => ⥜ + [↾] => ↾ + [⥔] => ⥔ + [⥓] => ⥓ + [â„] => ℝ + [⥰] => ⥰ + [â§´] => ⧴ + [Щ] => Щ + [Ш] => Ш + [Ь] => Ь + [Åš] => Ś + [⪼] => ⪼ + [Å ] => Š + [Åž] => Ş + [Åœ] => Ŝ + [С] => С + [ð”–] => 𝔖 + [Σ] => Σ + [ð•Š] => 𝕊 + [√] => √ + [â–¡] => □ + [⊑] => ⊑ + [⊒] => ⊒ + [ð’®] => 𝒮 + [⋆] => ⋆ + [â‹] => ⋐ + [⊆] => ⊆ + [⪰] => ⪰ + [≿] => ≿ + [â‹‘] => ⋑ + [Þ] => Þ + [Ћ] => Ћ + [Ц] => Ц + [ ] => + [Τ] => Τ + [Ť] => Ť + [Å¢] => Ţ + [Т] => Т + [ð”—] => 𝔗 + [Θ] => Θ + [âŸâ€Š] =>    + [ ] =>   + [≅] => ≅ + [ð•‹] => 𝕋 + [⃛] => ⃛ + [ð’¯] => 𝒯 + [Ŧ] => Ŧ + [Ú] => Ú + [↟] => ↟ + [⥉] => ⥉ + [ÐŽ] => Ў + [Ŭ] => Ŭ + [Û] => Û + [У] => У + [Ű] => Ű + [ð”˜] => 𝔘 + [Ù] => Ù + [Ū] => Ū + [âŸ] => ⏟ + [â] => ⏝ + [⊎] => ⊎ + [Ų] => Ų + [ð•Œ] => 𝕌 + [⤒] => ⤒ + [↕] => ↕ + [↥] => ↥ + [⇕] => ⇕ + [↗] => ↗ + [Î¥] => Υ + [Å®] => Ů + [ð’°] => 𝒰 + [Ũ] => Ũ + [Ü] => Ü + [⊫] => ⊫ + [â««] => ⫫ + [Ð’] => В + [⊩] => ⊩ + [⫦] => ⫦ + [‖] => ‖ + [â˜] => ❘ + [ð”™] => 𝔙 + [ð•] => 𝕍 + [ð’±] => 𝒱 + [⊪] => ⊪ + [Å´] => Ŵ + [ð”š] => 𝔚 + [ð•Ž] => 𝕎 + [ð’²] => 𝒲 + [ð”›] => 𝔛 + [Ξ] => Ξ + [ð•] => 𝕏 + [ð’³] => 𝒳 + [Я] => Я + [Ї] => Ї + [Ю] => Ю + [Ã] => Ý + [Ŷ] => Ŷ + [Ы] => Ы + [ð”œ] => 𝔜 + [ð•] => 𝕐 + [ð’´] => 𝒴 + [Ÿ] => Ÿ + [Ж] => Ж + [Ź] => Ź + [Ž] => Ž + [З] => З + [Å»] => Ż + [​] => ​ + [Ζ] => Ζ + [ℨ] => ℨ + [ℤ] => ℤ + [ð’µ] => 𝒵 + [á] => á + [ă] => ă + [∾] => ∾ + [∾̳] => ∾̳ + [∿] => ∿ + [â] => â + [а] => а + [æ] => æ + [â¡] => ⁡ + [ð”ž] => 𝔞 + [à] => à + [ℵ] => ℵ + [α] => α + [Ä] => ā + [⨿] => ⨿ + [&] => & + [∧] => ∧ + [â©•] => ⩕ + [⩜] => ⩜ + [⩘] => ⩘ + [⩚] => ⩚ + [⦤] => ⦤ + [∠] => ∠ + [∡] => ∡ + [⦨] => ⦨ + [⦩] => ⦩ + [⦪] => ⦪ + [⦫] => ⦫ + [⦬] => ⦬ + [⦭] => ⦭ + [⦮] => ⦮ + [⦯] => ⦯ + [∟] => ∟ + [⊾] => ⊾ + [â¦] => ⦝ + [∢] => ∢ + [â¼] => ⍼ + [Ä…] => ą + [ð•’] => 𝕒 + [â©°] => ⩰ + [⩯] => ⩯ + [≊] => ≊ + [≋] => ≋ + [≈] => ≈ + [Ã¥] => å + [ð’¶] => 𝒶 + [*] => * + [ã] => ã + [ä] => ä + [∳] => ∳ + [⨑] => ⨑ + [â«­] => ⫭ + [϶] => ϶ + [‵] => ‵ + [â‹] => ⋍ + [⊽] => ⊽ + [⌅] => ⌅ + [⎵] => ⎵ + [⎶] => ⎶ + [≌] => ≌ + [б] => б + [„] => „ + [⦰] => ⦰ + [β] => β + [â„¶] => ℶ + [≬] => ≬ + [ð”Ÿ] => 𝔟 + [â‹‚] => ⋂ + [â—¯] => ◯ + [⋃] => ⋃ + [â¨] => ⨁ + [⨂] => ⨂ + [⨆] => ⨆ + [â–½] => ▽ + [â–³] => △ + [⨄] => ⨄ + [â¤] => ⤍ + [â–´] => ▴ + [â–¾] => ▾ + [â—‚] => ◂ + [â–¸] => ▸ + [â£] => ␣ + [â–’] => ▒ + [â–‘] => ░ + [â–“] => ▓ + [â–ˆ] => █ + [=⃥] => =⃥ + [≡⃥] => ≡⃥ + [âŒ] => ⌐ + [ð•“] => 𝕓 + [⋈] => ⋈ + [â•—] => ╗ + [â•”] => ╔ + [â•–] => ╖ + [â•“] => ╓ + [â•] => ═ + [╦] => ╦ + [â•©] => ╩ + [╤] => ╤ + [â•§] => ╧ + [â•] => ╝ + [╚] => ╚ + [╜] => ╜ + [â•™] => ╙ + [â•‘] => ║ + [╬] => ╬ + [â•£] => ╣ + [â• ] => ╠ + [â•«] => ╫ + [â•¢] => ╢ + [╟] => ╟ + [⧉] => ⧉ + [â••] => ╕ + [â•’] => ╒ + [â”] => ┐ + [┌] => ┌ + [â•¥] => ╥ + [╨] => ╨ + [┬] => ┬ + [â”´] => ┴ + [⊟] => ⊟ + [⊞] => ⊞ + [â•›] => ╛ + [╘] => ╘ + [┘] => ┘ + [â””] => └ + [│] => │ + [╪] => ╪ + [â•¡] => ╡ + [╞] => ╞ + [┼] => ┼ + [┤] => ┤ + [├] => ├ + [¦] => ¦ + [ð’·] => 𝒷 + [â] => ⁏ + [∽] => ∽ + [\] => \ + [â§…] => ⧅ + [⟈] => ⟈ + [•] => • + [≎] => ≎ + [⪮] => ⪮ + [ć] => ć + [∩] => ∩ + [â©„] => ⩄ + [⩉] => ⩉ + [â©‹] => ⩋ + [⩇] => ⩇ + [â©€] => ⩀ + [∩︀] => ∩︀ + [â] => ⁁ + [â©] => ⩍ + [Ä] => č + [ç] => ç + [ĉ] => ĉ + [⩌] => ⩌ + [â©] => ⩐ + [Ä‹] => ċ + [⦲] => ⦲ + [¢] => ¢ + [ð” ] => 𝔠 + [ч] => ч + [✓] => ✓ + [χ] => χ + [â—‹] => ○ + [⧃] => ⧃ + [ˆ] => ˆ + [≗] => ≗ + [â¨] => ⨐ + [⫯] => ⫯ + [â§‚] => ⧂ + [♣] => ♣ + [:] => : + [≔] => ≔ + [,] => , + [@] => @ + [âˆ] => ∁ + [∘] => ∘ + [â„‚] => ℂ + [â©­] => ⩭ + [ð•”] => 𝕔 + [©] => © + [â„—] => ℗ + [↵] => ↵ + [✗] => ✗ + [ð’¸] => 𝒸 + [â«] => ⫏ + [â«‘] => ⫑ + [â«] => ⫐ + [â«’] => ⫒ + [⋯] => ⋯ + [⤸] => ⤸ + [⤵] => ⤵ + [⋟] => ⋟ + [⤽] => ⤽ + [∪] => ∪ + [⩈] => ⩈ + [⩆] => ⩆ + [⩊] => ⩊ + [âŠ] => ⊍ + [â©…] => ⩅ + [∪︀] => ∪︀ + [↷] => ↷ + [⤼] => ⤼ + [⋞] => ⋞ + [⋎] => ⋎ + [â‹] => ⋏ + [¤] => ¤ + [↶] => ↶ + [∲] => ∲ + [∱] => ∱ + [⌭] => ⌭ + [⥥] => ⥥ + [†] => † + [ℸ] => ℸ + [↓] => ↓ + [⊣] => ⊣ + [â¤] => ⤏ + [Ä] => ď + [д] => д + [â©·] => ⩷ + [°] => ° + [δ] => δ + [⦱] => ⦱ + [⥿] => ⥿ + [ð”¡] => 𝔡 + [⇃] => ⇃ + [â‹„] => ⋄ + [♦] => ♦ + [⋲] => ⋲ + [÷] => ÷ + [⋇] => ⋇ + [Ñ’] => ђ + [âŒ] => ⌍ + [$] => $ + [ð••] => 𝕕 + [Ë™] => ˙ + [≑] => ≑ + [⌆] => ⌆ + [⇊] => ⇊ + [â¤] => ⤐ + [⌟] => ⌟ + [⌌] => ⌌ + [ð’¹] => 𝒹 + [Ñ•] => ѕ + [â§¶] => ⧶ + [Ä‘] => đ + [⋱] => ⋱ + [⦦] => ⦦ + [ÑŸ] => џ + [⟿] => ⟿ + [é] => é + [â©®] => ⩮ + [Ä›] => ě + [≖] => ≖ + [ê] => ê + [Ñ] => э + [Ä—] => ė + [ð”¢] => 𝔢 + [⪚] => ⪚ + [è] => è + [⪖] => ⪖ + [⪘] => ⪘ + [⪙] => ⪙ + [â§] => ⏧ + [â„“] => ℓ + [⪕] => ⪕ + [⪗] => ⪗ + [Ä“] => ē + [∅] => ∅ + [ ] =>   + [ ] =>   + [ ] =>   + [Å‹] => ŋ + [ ] =>   + [Ä™] => ę + [ð•–] => 𝕖 + [â‹•] => ⋕ + [â§£] => ⧣ + [⩱] => ⩱ + [ε] => ε + [≕] => ≕ + [=] => = + [≟] => ≟ + [⩸] => ⩸ + [â§¥] => ⧥ + [⥱] => ⥱ + [ℯ] => ℯ + [â‰] => ≐ + [≂] => ≂ + [η] => η + [ð] => ð + [ë] => ë + [€] => € + [!] => ! + [â„°] => ℰ + [â…‡] => ⅇ + [≒] => ≒ + [Ñ„] => ф + [♀] => ♀ + [ffi] => ffi + [ff] => ff + [ffl] => ffl + [ð”£] => 𝔣 + [ï¬] => fi + [fj] => fj + [â™­] => ♭ + [fl] => fl + [â–±] => ▱ + [Æ’] => ƒ + [ð•—] => 𝕗 + [∀] => ∀ + [â«™] => ⫙ + [â¨] => ⨍ + [â…“] => ⅓ + [¼] => ¼ + [â…•] => ⅕ + [â…™] => ⅙ + [â…›] => ⅛ + [â…”] => ⅔ + [â…–] => ⅖ + [¾] => ¾ + [â…—] => ⅗ + [â…œ] => ⅜ + [â…˜] => ⅘ + [â…š] => ⅚ + [â…] => ⅝ + [â…ž] => ⅞ + [â„] => ⁄ + [⌢] => ⌢ + [ð’»] => 𝒻 + [⪌] => ⪌ + [ǵ] => ǵ + [γ] => γ + [Ï] => ϝ + [⪆] => ⪆ + [ÄŸ] => ğ + [Ä] => ĝ + [г] => г + [Ä¡] => ġ + [≥] => ≥ + [≧] => ≧ + [⩾] => ⩾ + [⪩] => ⪩ + [⪀] => ⪀ + [⪂] => ⪂ + [⪄] => ⪄ + [⋛︀] => ⋛︀ + [⪔] => ⪔ + [ð”¤] => 𝔤 + [≫] => ≫ + [â„·] => ℷ + [Ñ“] => ѓ + [≷] => ≷ + [⪒] => ⪒ + [⪥] => ⪥ + [⪤] => ⪤ + [⪊] => ⪊ + [⪈] => ⪈ + [≩] => ≩ + [â‹§] => ⋧ + [ð•˜] => 𝕘 + [`] => ` + [ℊ] => ℊ + [⪎] => ⪎ + [âª] => ⪐ + [>] => > + [⪧] => ⪧ + [⩺] => ⩺ + [⦕] => ⦕ + [⩼] => ⩼ + [⥸] => ⥸ + [â‹—] => ⋗ + [â‹›] => ⋛ + [≩︀] => ≩︀ + [⇔] => ⇔ + [ ] =>   + [½] => ½ + [ÑŠ] => ъ + [↔] => ↔ + [⥈] => ⥈ + [↭] => ↭ + [Ä¥] => ĥ + [♥] => ♥ + […] => … + [⊹] => ⊹ + [ð”¥] => 𝔥 + [⇿] => ⇿ + [∻] => ∻ + [ð•™] => 𝕙 + [―] => ― + [ð’½] => 𝒽 + [ħ] => ħ + [âƒ] => ⁃ + [â€] => ‐ + [í] => í + [â£] => ⁣ + [î] => î + [и] => и + [е] => е + [¡] => ¡ + [ð”¦] => 𝔦 + [ì] => ì + [⨌] => ⨌ + [â§œ] => ⧜ + [â„©] => ℩ + [ij] => ij + [Ä«] => ī + [â„] => ℐ + [⊷] => ⊷ + [Ƶ] => Ƶ + [â„…] => ℅ + [∞] => ∞ + [â§] => ⧝ + [ı] => ı + [⊺] => ⊺ + [⨗] => ⨗ + [Ñ‘] => ё + [į] => į + [ð•š] => 𝕚 + [ι] => ι + [⨼] => ⨼ + [¿] => ¿ + [ð’¾] => 𝒾 + [⋹] => ⋹ + [⋵] => ⋵ + [â‹´] => ⋴ + [⋳] => ⋳ + [∈] => ∈ + [Ä©] => ĩ + [Ñ–] => і + [ï] => ï + [ĵ] => ĵ + [й] => й + [ð”§] => 𝔧 + [È·] => ȷ + [ð•›] => 𝕛 + [ð’¿] => 𝒿 + [ј] => ј + [Ñ”] => є + [κ] => κ + [Ä·] => ķ + [к] => к + [ð”¨] => 𝔨 + [ĸ] => ĸ + [Ñ…] => х + [Ñœ] => ќ + [ð•œ] => 𝕜 + [ð“€] => 𝓀 + [⇚] => ⇚ + [⤛] => ⤛ + [⤎] => ⤎ + [≦] => ≦ + [⥢] => ⥢ + [ĺ] => ĺ + [⦴] => ⦴ + [â„’] => ℒ + [λ] => λ + [⦑] => ⦑ + [⟨] => ⟨ + [⪅] => ⪅ + [«] => « + [â†] => ← + [⤟] => ⤟ + [â¤] => ⤝ + [↩] => ↩ + [↫] => ↫ + [⤹] => ⤹ + [⥳] => ⥳ + [↢] => ↢ + [⪫] => ⪫ + [⤙] => ⤙ + [⪭] => ⪭ + [⪭︀] => ⪭︀ + [⤌] => ⤌ + [â²] => ❲ + [{] => { + [[] => [ + [⦋] => ⦋ + [â¦] => ⦏ + [â¦] => ⦍ + [ľ] => ľ + [ļ] => ļ + [⌈] => ⌈ + [л] => л + [⤶] => ⤶ + [⥧] => ⥧ + [⥋] => ⥋ + [↲] => ↲ + [↽] => ↽ + [↼] => ↼ + [⇋] => ⇋ + [≤] => ≤ + [⩽] => ⩽ + [⪨] => ⪨ + [â©¿] => ⩿ + [âª] => ⪁ + [⪃] => ⪃ + [⋚︀] => ⋚︀ + [⪓] => ⪓ + [â‹–] => ⋖ + [⋚] => ⋚ + [⪋] => ⪋ + [≶] => ≶ + [⥼] => ⥼ + [ð”©] => 𝔩 + [⪑] => ⪑ + [⥪] => ⥪ + [â–„] => ▄ + [Ñ™] => љ + [≪] => ≪ + [⇇] => ⇇ + [⌞] => ⌞ + [⥫] => ⥫ + [â—º] => ◺ + [Å€] => ŀ + [⎰] => ⎰ + [⪉] => ⪉ + [⪇] => ⪇ + [≨] => ≨ + [⋦] => ⋦ + [⟬] => ⟬ + [⇽] => ⇽ + [⟵] => ⟵ + [↬] => ↬ + [⦅] => ⦅ + [ð•] => 𝕝 + [⨭] => ⨭ + [⨴] => ⨴ + [∗] => ∗ + [_] => _ + [â—Š] => ◊ + [â§«] => ⧫ + [(] => ( + [⦓] => ⦓ + [⇆] => ⇆ + [⥭] => ⥭ + [‎] => ‎ + [⊿] => ⊿ + [‹] => ‹ + [ð“] => 𝓁 + [âª] => ⪍ + [âª] => ⪏ + [Å‚] => ł + [<] => < + [⪦] => ⪦ + [⩹] => ⩹ + [â‹‹] => ⋋ + [⋉] => ⋉ + [⥶] => ⥶ + [â©»] => ⩻ + [⦖] => ⦖ + [â—ƒ] => ◃ + [⥊] => ⥊ + [⥦] => ⥦ + [≨︀] => ≨︀ + [∺] => ∺ + [¯] => ¯ + [♂] => ♂ + [✠] => ✠ + [↦] => ↦ + [â–®] => ▮ + [⨩] => ⨩ + [м] => м + [—] => — + [ð”ª] => 𝔪 + [â„§] => ℧ + [µ] => µ + [∣] => ∣ + [â«°] => ⫰ + [−] => − + [∸] => ∸ + [⨪] => ⨪ + [â«›] => ⫛ + [⊧] => ⊧ + [ð•ž] => 𝕞 + [ð“‚] => 𝓂 + [μ] => μ + [⊸] => ⊸ + [⋙̸] => ⋙̸ + [≫⃒] => ≫⃒ + [â‡] => ⇍ + [⋘̸] => ⋘̸ + [≪⃒] => ≪⃒ + [≪̸] => ≪̸ + [⊯] => ⊯ + [⊮] => ⊮ + [∇] => ∇ + [Å„] => ń + [∠⃒] => ∠⃒ + [⩰̸] => ⩰̸ + [≋̸] => ≋̸ + [ʼn] => ʼn + [≉] => ≉ + [â™®] => ♮ + [â„•] => ℕ + [ ] =>   + [≎̸] => ≎̸ + [â‰Ì¸] => ≏̸ + [⩃] => ⩃ + [ň] => ň + [ņ] => ņ + [≇] => ≇ + [⩭̸] => ⩭̸ + [â©‚] => ⩂ + [н] => н + [–] => – + [⇗] => ⇗ + [⤤] => ⤤ + [â‰Ì¸] => ≐̸ + [≂̸] => ≂̸ + [∄] => ∄ + [ð”«] => 𝔫 + [≱] => ≱ + [⩾̸] => ⩾̸ + [≵] => ≵ + [≯] => ≯ + [⇎] => ⇎ + [⫲] => ⫲ + [⋼] => ⋼ + [⋺] => ⋺ + [Ñš] => њ + [≦̸] => ≦̸ + [‥] => ‥ + [↚] => ↚ + [↮] => ↮ + [⩽̸] => ⩽̸ + [≴] => ≴ + [⋪] => ⋪ + [⋬] => ⋬ + [ð•Ÿ] => 𝕟 + [¬] => ¬ + [∉] => ∉ + [⋹̸] => ⋹̸ + [⋵̸] => ⋵̸ + [â‹·] => ⋷ + [â‹¶] => ⋶ + [∌] => ∌ + [⋾] => ⋾ + [⋽] => ⋽ + [∦] => ∦ + [⫽⃥] => ⫽⃥ + [∂̸] => ∂̸ + [⨔] => ⨔ + [⊀] => ⊀ + [â‡] => ⇏ + [↛] => ↛ + [⤳̸] => ⤳̸ + [â†Ì¸] => ↝̸ + [ð“ƒ] => 𝓃 + [∤] => ∤ + [≄] => ≄ + [⊄] => ⊄ + [⫅̸] => ⫅̸ + [⊅] => ⊅ + [⊃⃒] => ⊃⃒ + [⫆̸] => ⫆̸ + [ñ] => ñ + [≸] => ≸ + [â‹«] => ⋫ + [ν] => ν + [#] => # + [â„–] => № + [ ] =>   + [⊭] => ⊭ + [⤄] => ⤄ + [â‰âƒ’] => ≍⃒ + [⊬] => ⊬ + [≥⃒] => ≥⃒ + [>⃒] => >⃒ + [â§ž] => ⧞ + [⤂] => ⤂ + [≤⃒] => ≤⃒ + [<⃒] => <⃒ + [⊴⃒] => ⊴⃒ + [⤃] => ⤃ + [⊵⃒] => ⊵⃒ + [∼⃒] => ∼⃒ + [⇖] => ⇖ + [⤣] => ⤣ + [↖] => ↖ + [⤧] => ⤧ + [Ⓢ] => Ⓢ + [ó] => ó + [⊛] => ⊛ + [⊚] => ⊚ + [ô] => ô + [о] => о + [âŠ] => ⊝ + [Å‘] => ő + [⨸] => ⨸ + [⦼] => ⦼ + [Å“] => œ + [⦿] => ⦿ + [ð”¬] => 𝔬 + [Ë›] => ˛ + [ò] => ò + [â§] => ⧁ + [⦵] => ⦵ + [↺] => ↺ + [⦾] => ⦾ + [⦻] => ⦻ + [‾] => ‾ + [â§€] => ⧀ + [Å] => ō + [ω] => ω + [ο] => ο + [⦶] => ⦶ + [⊖] => ⊖ + [ð• ] => 𝕠 + [⦷] => ⦷ + [⦹] => ⦹ + [∨] => ∨ + [↻] => ↻ + [â©] => ⩝ + [â„´] => ℴ + [ª] => ª + [º] => º + [⊶] => ⊶ + [â©–] => ⩖ + [â©—] => ⩗ + [â©›] => ⩛ + [ø] => ø + [⊘] => ⊘ + [õ] => õ + [⨶] => ⨶ + [ö] => ö + [⌽] => ⌽ + [¶] => ¶ + [⫳] => ⫳ + [⫽] => ⫽ + [∂] => ∂ + [п] => п + [%] => % + [.] => . + [‰] => ‰ + [⊥] => ⊥ + [‱] => ‱ + [ð”­] => 𝔭 + [φ] => φ + [☎] => ☎ + [Ï€] => π + [â‹”] => ⋔ + [Ï–] => ϖ + [â„] => ℏ + [ℎ] => ℎ + [+] => + + [⨣] => ⨣ + [⨢] => ⨢ + [∔] => ∔ + [⨥] => ⨥ + [⩲] => ⩲ + [±] => ± + [⨦] => ⨦ + [⨧] => ⨧ + [⨕] => ⨕ + [ð•¡] => 𝕡 + [£] => £ + [⪳] => ⪳ + [≺] => ≺ + [⪷] => ⪷ + [⪯] => ⪯ + [⪹] => ⪹ + [⪵] => ⪵ + [⋨] => ⋨ + [≾] => ≾ + [′] => ′ + [â„™] => ℙ + [âˆ] => ∏ + [⌮] => ⌮ + [⌒] => ⌒ + [⌓] => ⌓ + [âˆ] => ∝ + [⊰] => ⊰ + [ð“…] => 𝓅 + [ψ] => ψ + [ ] =>   + [ð”®] => 𝔮 + [ð•¢] => 𝕢 + [â—] => ⁗ + [ð“†] => 𝓆 + [⨖] => ⨖ + [?] => ? + ["] => " + [⇛] => ⇛ + [⤜] => ⤜ + [⥤] => ⥤ + [∽̱] => ∽̱ + [Å•] => ŕ + [⦳] => ⦳ + [⦒] => ⦒ + [⦥] => ⦥ + [»] => » + [⥵] => ⥵ + [⤠] => ⤠ + [⤳] => ⤳ + [⤞] => ⤞ + [↪] => ↪ + [⥅] => ⥅ + [⥴] => ⥴ + [↣] => ↣ + [â†] => ↝ + [⤚] => ⤚ + [∶] => ∶ + [ℚ] => ℚ + [â³] => ❳ + [⦌] => ⦌ + [⦎] => ⦎ + [â¦] => ⦐ + [Å™] => ř + [Å—] => ŗ + [}] => } + [Ñ€] => р + [⤷] => ⤷ + [⥩] => ⥩ + [â€] => ” + [↳] => ↳ + [â„›] => ℛ + [â–­] => ▭ + [®] => ® + [⥽] => ⥽ + [ð”¯] => 𝔯 + [â‡] => ⇁ + [⇀] => ⇀ + [⥬] => ⥬ + [Ï] => ρ + [ϱ] => ϱ + [⇄] => ⇄ + [⇌] => ⇌ + [Ëš] => ˚ + [≓] => ≓ + [â€] => ‏ + [⎱] => ⎱ + [â«®] => ⫮ + [⟭] => ⟭ + [⇾] => ⇾ + [⦆] => ⦆ + [ð•£] => 𝕣 + [⨮] => ⨮ + [⨵] => ⨵ + [)] => ) + [⦔] => ⦔ + [⨒] => ⨒ + [⇉] => ⇉ + [›] => › + [ð“‡] => 𝓇 + [↱] => ↱ + []] => ] + [’] => ’ + [⋌] => ⋌ + [⋊] => ⋊ + [â–¹] => ▹ + [â§Ž] => ⧎ + [⥨] => ⥨ + [℞] => ℞ + [Å›] => ś + [‚] => ‚ + [⪴] => ⪴ + [Å¡] => š + [ÅŸ] => ş + [Å] => ŝ + [⪶] => ⪶ + [â‹©] => ⋩ + [⨓] => ⨓ + [Ñ] => с + [â‹…] => ⋅ + [⊡] => ⊡ + [⩦] => ⩦ + [⇘] => ⇘ + [⤥] => ⤥ + [§] => § + [;] => ; + [⤩] => ⤩ + [✶] => ✶ + [ð”°] => 𝔰 + [♯] => ♯ + [щ] => щ + [ш] => ш + [∥] => ∥ + [­] => ­ + [σ] => σ + [Ï‚] => ς + [∼] => ∼ + [⩪] => ⩪ + [≃] => ≃ + [⪞] => ⪞ + [⪠] => ⪠ + [âª] => ⪝ + [⪟] => ⪟ + [≆] => ≆ + [⨤] => ⨤ + [⥲] => ⥲ + [⨳] => ⨳ + [⧤] => ⧤ + [⌣] => ⌣ + [⪪] => ⪪ + [⪬] => ⪬ + [⪬︀] => ⪬︀ + [ÑŒ] => ь + [/] => / + [â§„] => ⧄ + [⌿] => ⌿ + [ð•¤] => 𝕤 + [â™ ] => ♠ + [⊓] => ⊓ + [⊓︀] => ⊓︀ + [⊔] => ⊔ + [⊔︀] => ⊔︀ + [âŠ] => ⊏ + [âŠ] => ⊐ + [â–ª] => ▪ + [→] => → + [ð“ˆ] => 𝓈 + [∖] => ∖ + [☆] => ☆ + [★] => ★ + [ϵ] => ϵ + [Ï•] => ϕ + [⊂] => ⊂ + [â«…] => ⫅ + [⪽] => ⪽ + [⫃] => ⫃ + [â«] => ⫁ + [⪿] => ⪿ + [⥹] => ⥹ + [⊊] => ⊊ + [â«‹] => ⫋ + [⫇] => ⫇ + [â«•] => ⫕ + [â«“] => ⫓ + [≻] => ≻ + [⪸] => ⪸ + [≽] => ≽ + [⪺] => ⪺ + [∑] => ∑ + [♪] => ♪ + [¹] => ¹ + [²] => ² + [³] => ³ + [⊃] => ⊃ + [⪾] => ⪾ + [⫘] => ⫘ + [⊇] => ⊇ + [â«„] => ⫄ + [⟉] => ⟉ + [â«—] => ⫗ + [⥻] => ⥻ + [â«‚] => ⫂ + [⫌] => ⫌ + [â«€] => ⫀ + [⫆] => ⫆ + [⊋] => ⊋ + [⫈] => ⫈ + [â«”] => ⫔ + [â«–] => ⫖ + [⇙] => ⇙ + [⤦] => ⤦ + [↙] => ↙ + [⤪] => ⤪ + [ß] => ß + [⌖] => ⌖ + [Ï„] => τ + [Å¥] => ť + [Å£] => ţ + [Ñ‚] => т + [⌕] => ⌕ + [ð”±] => 𝔱 + [∴] => ∴ + [θ] => θ + [Ï‘] => ϑ + [þ] => þ + [×] => × + [⊠] => ⊠ + [⨱] => ⨱ + [⨰] => ⨰ + [∭] => ∭ + [⤨] => ⤨ + [⌶] => ⌶ + [⫱] => ⫱ + [ð•¥] => 𝕥 + [⫚] => ⫚ + [‴] => ‴ + [â„¢] => ™ + [â–µ] => ▵ + [â–¿] => ▿ + [≜] => ≜ + [â—¬] => ◬ + [⨺] => ⨺ + [⨹] => ⨹ + [â§] => ⧍ + [⨻] => ⨻ + [â¢] => ⏢ + [ð“‰] => 𝓉 + [ц] => ц + [Ñ›] => ћ + [ŧ] => ŧ + [↠] => ↠ + [⥣] => ⥣ + [ú] => ú + [↑] => ↑ + [Ñž] => ў + [Å­] => ŭ + [û] => û + [у] => у + [⇅] => ⇅ + [ű] => ű + [⥮] => ⥮ + [⥾] => ⥾ + [ð”²] => 𝔲 + [ù] => ù + [↿] => ↿ + [â–€] => ▀ + [⌜] => ⌜ + [âŒ] => ⌏ + [â—¸] => ◸ + [Å«] => ū + [ų] => ų + [ð•¦] => 𝕦 + [Ï…] => υ + [Ï’] => ϒ + [⇈] => ⇈ + [âŒ] => ⌝ + [⌎] => ⌎ + [ů] => ů + [â—¹] => ◹ + [ð“Š] => 𝓊 + [â‹°] => ⋰ + [Å©] => ũ + [ü] => ü + [⦧] => ⦧ + [⫨] => ⫨ + [â«©] => ⫩ + [⦜] => ⦜ + [ϰ] => ϰ + [⫌︀] => ⫌︀ + [⊲] => ⊲ + [в] => в + [⊢] => ⊢ + [⊻] => ⊻ + [≚] => ≚ + [â‹®] => ⋮ + [|] => | + [ð”³] => 𝔳 + [⊂⃒] => ⊂⃒ + [ð•§] => 𝕧 + [⊳] => ⊳ + [ð“‹] => 𝓋 + [⫋︀] => ⫋︀ + [⊊︀] => ⊊︀ + [⊋︀] => ⊋︀ + [⦚] => ⦚ + [ŵ] => ŵ + [⩟] => ⩟ + [≙] => ≙ + [ð”´] => 𝔴 + [ð•¨] => 𝕨 + [℘] => ℘ + [≀] => ≀ + [ð“Œ] => 𝓌 + [ð”µ] => 𝔵 + [⟺] => ⟺ + [ξ] => ξ + [⟸] => ⟸ + [⟼] => ⟼ + [â‹»] => ⋻ + [⨀] => ⨀ + [ð•©] => 𝕩 + [ð“] => 𝓍 + [â‹] => ⋁ + [â‹€] => ⋀ + [ý] => ý + [Ñ] => я + [Å·] => ŷ + [Ñ‹] => ы + [Â¥] => ¥ + [ð”¶] => 𝔶 + [Ñ—] => ї + [ð•ª] => 𝕪 + [ð“Ž] => 𝓎 + [ÑŽ] => ю + [ÿ] => ÿ + [ź] => ź + [ž] => ž + [з] => з + [ż] => ż + [ζ] => ζ + [ð”·] => 𝔷 + [ж] => ж + [â‡] => ⇝ + [ð•«] => 𝕫 + [ð“] => 𝓏 + [â€] => ‍ + [‌] => ‌ +) +-- with table = HTML_ENTITIES, ENT_QUOTES -- +int(1511) +-- with table = HTML_ENTITIES, ENT_NOQUOTES -- +int(1509) +-- with table = HTML_SPECIALCHARS, ENT_COMPAT -- +int(4) +Array +( + [&] => & + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- +array(5) { + ["&"]=> + string(5) "&" + ["'"]=> + string(6) "'" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic6.phpt b/tests/std/strings/get_html_translation_table_basic6.phpt new file mode 100644 index 00000000..c5042c96 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic6.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - HTML 5/Windows-1251 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 *** +-- with table = HTML_ENTITIES, ENT_COMPAT -- +int(157) +Array +( + [ ] => + [ +] => + [!] => ! + ["] => " + [#] => # + [$] => $ + [%] => % + [&] => & + [(] => ( + [)] => ) + [*] => * + [+] => + + [,] => , + [.] => . + [/] => / + [:] => : + [;] => ; + [<] => < + [=] => = + [>] => > + [?] => ? + [@] => @ + [[] => [ + [\] => \ + []] => ] + [^] => ^ + [_] => _ + [`] => ` + [fj] => fj + [{] => { + [|] => | + [}] => } + [€] => Ђ + [] => Ѓ + [‚] => ‚ + [ƒ] => ѓ + [„] => „ + […] => … + [†] => † + [‡] => ‡ + [ˆ] => € + [‰] => ‰ + [Š] => Љ + [‹] => ‹ + [Œ] => Њ + [] => Ќ + [Ž] => Ћ + [] => Џ + [] => ђ + [‘] => ‘ + [’] => ’ + [“] => “ + [”] => ” + [•] => • + [–] => – + [—] => — + [™] => ™ + [š] => љ + [›] => › + [œ] => њ + [] => ќ + [ž] => ћ + [Ÿ] => џ + [ ] =>   + [¡] => Ў + [¢] => ў + [£] => Ј + [¤] => ¤ + [¦] => ¦ + [§] => § + [¨] => Ё + [©] => © + [ª] => Є + [«] => « + [¬] => ¬ + [­] => ­ + [®] => ® + [¯] => Ї + [°] => ° + [±] => ± + [²] => І + [³] => і + [µ] => µ + [¶] => ¶ + [·] => · + [¸] => ё + [¹] => № + [º] => є + [»] => » + [¼] => ј + [½] => Ѕ + [¾] => ѕ + [¿] => ї + [À] => А + [Á] => Б + [Â] => В + [Ã] => Г + [Ä] => Д + [Å] => Е + [Æ] => Ж + [Ç] => З + [È] => И + [É] => Й + [Ê] => К + [Ë] => Л + [Ì] => М + [Í] => Н + [Î] => О + [Ï] => П + [Ð] => Р + [Ñ] => С + [Ò] => Т + [Ó] => У + [Ô] => Ф + [Õ] => Х + [Ö] => Ц + [×] => Ч + [Ø] => Ш + [Ù] => Щ + [Ú] => Ъ + [Û] => Ы + [Ü] => Ь + [Ý] => Э + [Þ] => Ю + [ß] => Я + [à] => а + [á] => б + [â] => в + [ã] => г + [ä] => д + [å] => е + [æ] => ж + [ç] => з + [è] => и + [é] => й + [ê] => к + [ë] => л + [ì] => м + [í] => н + [î] => о + [ï] => п + [ð] => р + [ñ] => с + [ò] => т + [ó] => у + [ô] => ф + [õ] => х + [ö] => ц + [÷] => ч + [ø] => ш + [ù] => щ + [ú] => ъ + [û] => ы + [ü] => ь + [ý] => э + [þ] => ю + [ÿ] => я +) +-- with table = HTML_ENTITIES, ENT_QUOTES -- +int(158) +-- with table = HTML_ENTITIES, ENT_NOQUOTES -- +int(156) +-- with table = HTML_SPECIALCHARS, ENT_COMPAT -- +int(4) +Array +( + ["] => " + [&] => & + [<] => < + [>] => > +) +-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- +array(5) { + ["""]=> + string(6) """ + ["&"]=> + string(5) "&" + ["'"]=> + string(6) "'" + ["<"]=> + string(4) "<" + [">"]=> + string(4) ">" +} +-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + ["<"]=> + string(4) "<" + [">"]=> + string(4) ">" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic7.phpt b/tests/std/strings/get_html_translation_table_basic7.phpt new file mode 100644 index 00000000..0f7a896e --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic7.phpt @@ -0,0 +1,342 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - XHTML 1.0 +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality/XHTML 1.0 *** +-- with table = HTML_ENTITIES, ENT_QUOTES -- +int(253) +Array +( + ['] => ' + [Æ] => Æ + [Ã] => Á + [Â] =>  + [À] => À + [Α] => Α + [Ã…] => Å + [Ã] => à + [Ä] => Ä + [Î’] => Β + [Ç] => Ç + [Χ] => Χ + [‡] => ‡ + [Δ] => Δ + [Ã] => Ð + [É] => É + [Ê] => Ê + [È] => È + [Ε] => Ε + [Η] => Η + [Ë] => Ë + [Γ] => Γ + [Ã] => Í + [ÃŽ] => Î + [ÃŒ] => Ì + [Ι] => Ι + [Ã] => Ï + [Κ] => Κ + [Λ] => Λ + [Μ] => Μ + [Ñ] => Ñ + [Î] => Ν + [Å’] => Œ + [Ó] => Ó + [Ô] => Ô + [Ã’] => Ò + [Ω] => Ω + [Ο] => Ο + [Ø] => Ø + [Õ] => Õ + [Ö] => Ö + [Φ] => Φ + [Π] => Π + [″] => ″ + [Ψ] => Ψ + [Ρ] => Ρ + [Å ] => Š + [Σ] => Σ + [Þ] => Þ + [Τ] => Τ + [Θ] => Θ + [Ú] => Ú + [Û] => Û + [Ù] => Ù + [Î¥] => Υ + [Ü] => Ü + [Ξ] => Ξ + [Ã] => Ý + [Ÿ] => Ÿ + [Ζ] => Ζ + [á] => á + [â] => â + [´] => ´ + [æ] => æ + [à] => à + [ℵ] => ℵ + [α] => α + [&] => & + [∧] => ∧ + [∠] => ∠ + [Ã¥] => å + [≈] => ≈ + [ã] => ã + [ä] => ä + [„] => „ + [β] => β + [¦] => ¦ + [•] => • + [∩] => ∩ + [ç] => ç + [¸] => ¸ + [¢] => ¢ + [χ] => χ + [ˆ] => ˆ + [♣] => ♣ + [≅] => ≅ + [©] => © + [↵] => ↵ + [∪] => ∪ + [¤] => ¤ + [⇓] => ⇓ + [†] => † + [↓] => ↓ + [°] => ° + [δ] => δ + [♦] => ♦ + [÷] => ÷ + [é] => é + [ê] => ê + [è] => è + [∅] => ∅ + [ ] =>   + [ ] =>   + [ε] => ε + [≡] => ≡ + [η] => η + [ð] => ð + [ë] => ë + [€] => € + [∃] => ∃ + [Æ’] => ƒ + [∀] => ∀ + [½] => ½ + [¼] => ¼ + [¾] => ¾ + [â„] => ⁄ + [γ] => γ + [≥] => ≥ + [>] => > + [⇔] => ⇔ + [↔] => ↔ + [♥] => ♥ + […] => … + [í] => í + [î] => î + [¡] => ¡ + [ì] => ì + [â„‘] => ℑ + [∞] => ∞ + [∫] => ∫ + [ι] => ι + [¿] => ¿ + [∈] => ∈ + [ï] => ï + [κ] => κ + [â‡] => ⇐ + [λ] => λ + [〈] => ⟨ + [«] => « + [â†] => ← + [⌈] => ⌈ + [“] => “ + [≤] => ≤ + [⌊] => ⌊ + [∗] => ∗ + [â—Š] => ◊ + [‎] => ‎ + [‹] => ‹ + [‘] => ‘ + [<] => < + [¯] => ¯ + [—] => — + [µ] => µ + [·] => · + [−] => − + [μ] => μ + [∇] => ∇ + [ ] =>   + [–] => – + [≠] => ≠ + [∋] => ∋ + [¬] => ¬ + [∉] => ∉ + [⊄] => ⊄ + [ñ] => ñ + [ν] => ν + [ó] => ó + [ô] => ô + [Å“] => œ + [ò] => ò + [‾] => ‾ + [ω] => ω + [ο] => ο + [⊕] => ⊕ + [∨] => ∨ + [ª] => ª + [º] => º + [ø] => ø + [õ] => õ + [⊗] => ⊗ + [ö] => ö + [¶] => ¶ + [∂] => ∂ + [‰] => ‰ + [⊥] => ⊥ + [φ] => φ + [Ï€] => π + [Ï–] => ϖ + [±] => ± + [£] => £ + [′] => ′ + [âˆ] => ∏ + [âˆ] => ∝ + [ψ] => ψ + ["] => " + [⇒] => ⇒ + [√] => √ + [〉] => ⟩ + [»] => » + [→] => → + [⌉] => ⌉ + [â€] => ” + [ℜ] => ℜ + [®] => ® + [⌋] => ⌋ + [Ï] => ρ + [â€] => ‏ + [›] => › + [’] => ’ + [‚] => ‚ + [Å¡] => š + [â‹…] => ⋅ + [§] => § + [­] => ­ + [σ] => σ + [Ï‚] => ς + [∼] => ∼ + [â™ ] => ♠ + [⊂] => ⊂ + [⊆] => ⊆ + [∑] => ∑ + [¹] => ¹ + [²] => ² + [³] => ³ + [⊃] => ⊃ + [⊇] => ⊇ + [ß] => ß + [Ï„] => τ + [∴] => ∴ + [θ] => θ + [Ï‘] => ϑ + [ ] =>   + [þ] => þ + [Ëœ] => ˜ + [×] => × + [â„¢] => ™ + [⇑] => ⇑ + [ú] => ú + [↑] => ↑ + [û] => û + [ù] => ù + [¨] => ¨ + [Ï’] => ϒ + [Ï…] => υ + [ü] => ü + [℘] => ℘ + [ξ] => ξ + [ý] => ý + [Â¥] => ¥ + [ÿ] => ÿ + [ζ] => ζ + [â€] => ‍ + [‌] => ‌ +) +-- with table = HTML_ENTITIES, ENT_COMPAT -- +int(252) +-- with table = HTML_ENTITIES, ENT_NOQUOTES -- +int(251) +-- with table = HTML_SPECIALCHARS, ENT_COMPAT -- +int(4) +Array +( + [&] => & + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- +array(5) { + ["&"]=> + string(5) "&" + ["'"]=> + string(6) "'" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic8.phpt b/tests/std/strings/get_html_translation_table_basic8.phpt new file mode 100644 index 00000000..a3813262 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic8.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - XML 1.0 +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality/XML 1.0 *** +-- with table = HTML_ENTITIES, ENT_QUOTES -- +int(5) +Array +( + [&] => & + ['] => ' + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_ENTITIES, ENT_COMPAT -- +int(4) +-- with table = HTML_ENTITIES, ENT_NOQUOTES -- +int(3) +-- with table = HTML_SPECIALCHARS, ENT_COMPAT -- +int(4) +Array +( + [&] => & + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- +array(5) { + ["&"]=> + string(5) "&" + ["'"]=> + string(6) "'" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" +} +Done diff --git a/tests/std/strings/get_html_translation_table_basic9.phpt b/tests/std/strings/get_html_translation_table_basic9.phpt new file mode 100644 index 00000000..595d8fd9 --- /dev/null +++ b/tests/std/strings/get_html_translation_table_basic9.phpt @@ -0,0 +1,95 @@ +--TEST-- +Test get_html_translation_table() function : basic functionality - HTML5 /sjis +--FILE-- + +--EXPECT-- +*** Testing get_html_translation_table() : basic functionality/HTML5/SJIS *** +*** Only basic entities supported! *** +-- with table = HTML_ENTITIES, ENT_QUOTES -- +int(5) +Array +( + [&] => & + ['] => ' + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_ENTITIES, ENT_COMPAT -- +int(4) +-- with table = HTML_ENTITIES, ENT_NOQUOTES -- +int(3) +-- with table = HTML_SPECIALCHARS, ENT_COMPAT -- +int(4) +Array +( + [&] => & + [>] => > + [<] => < + ["] => " +) +-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- +array(5) { + ["&"]=> + string(5) "&" + ["'"]=> + string(6) "'" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" + ["""]=> + string(6) """ +} +-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- +array(3) { + ["&"]=> + string(5) "&" + [">"]=> + string(4) ">" + ["<"]=> + string(4) "<" +} +Done diff --git a/tests/std/strings/get_meta_tags.phpt b/tests/std/strings/get_meta_tags.phpt new file mode 100644 index 00000000..8752117a --- /dev/null +++ b/tests/std/strings/get_meta_tags.phpt @@ -0,0 +1,95 @@ +--TEST-- +get_meta_tags() tests +--FILE-- + + + + + +DATA; + +$data1 = << + + + + + + + + + + + + + +DATA; + +$data2 = << +DATA; + +$data3 = << +DATA; + +$data4 = <<", " +--EXPECT-- +array(4) { + ["author"]=> + string(4) "name" + ["keywords"]=> + string(17) "php documentation" + ["description"]=> + string(12) "a php manual" + ["geo_position"]=> + string(12) "49.33;-86.59" +} +array(4) { + ["author"]=> + string(4) "name" + ["keywords"]=> + string(17) "php documentation" + ["description"]=> + string(12) "a php manual" + ["geo_position"]=> + string(12) "49.33;-86.59" +} +array(1) { + ["keywords"]=> + string(17) "php documentation" +} +array(1) { + ["keywords"]=> + string(17) "php documentation" +} +array(0) { +} +array(0) { +} +array(0) { +} +array(0) { +} +Done diff --git a/tests/std/strings/gh10187.phpt b/tests/std/strings/gh10187.phpt new file mode 100644 index 00000000..b42c95e5 --- /dev/null +++ b/tests/std/strings/gh10187.phpt @@ -0,0 +1,8 @@ +--TEST-- +GH-10187 (Segfault in stripslashes() with arm64) +--FILE-- + +--EXPECT-- +string(15) "1234567890abcde" diff --git a/tests/std/strings/gh10940.phpt b/tests/std/strings/gh10940.phpt new file mode 100644 index 00000000..ec6c56b8 --- /dev/null +++ b/tests/std/strings/gh10940.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test unpacking at the 32-bit integer limit +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: unpack(): Type h: not enough input values, need 1073741824 values but only 12 were provided in %s on line %d diff --git a/tests/std/strings/gh11982.phpt b/tests/std/strings/gh11982.phpt new file mode 100644 index 00000000..e5e45e7e --- /dev/null +++ b/tests/std/strings/gh11982.phpt @@ -0,0 +1,26 @@ +--TEST-- +GH-11982 (str_getcsv returns null byte for unterminated quoted string) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(0) "" +} +array(2) { + [0]=> + string(5) "field" + [1]=> + string(0) "" +} +array(2) { + [0]=> + string(0) "" + [1]=> + string(1) "a" +} + diff --git a/tests/std/strings/gh12151.phpt b/tests/std/strings/gh12151.phpt new file mode 100644 index 00000000..6a21f205 --- /dev/null +++ b/tests/std/strings/gh12151.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-12151 (str_getcsv ending with escape zero segfualt) +--FILE-- + +--EXPECT-- +array ( + 0 => '' . "\0" . '', +) +array ( + 0 => '' . "\0" . '', + 1 => '' . "\0" . '', +) diff --git a/tests/std/strings/gh15552.phpt b/tests/std/strings/gh15552.phpt new file mode 100644 index 00000000..60804e02 --- /dev/null +++ b/tests/std/strings/gh15552.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug GH-15552 (Signed integer overflow in ext/standard/scanf.c) +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught ValueError: "%n$" argument index out of range in %s:%d +Stack trace:%A diff --git a/tests/std/strings/gh15613.phpt b/tests/std/strings/gh15613.phpt new file mode 100644 index 00000000..44c41acf --- /dev/null +++ b/tests/std/strings/gh15613.phpt @@ -0,0 +1,26 @@ +--TEST-- +GH-15613 overflow on hex strings repeater value +--SKIPIF-- + +--INI-- +memory_limit=-1 +--FILE-- +getMessage() . PHP_EOL; +} + +try { + unpack('H2147483647', str_repeat('X', 2**31 + 10)); +} catch (\ValueError $e) { + echo $e->getMessage(); +} +?> +--EXPECTF-- +unpack(): Argument #1 ($format) repeater must be less than or equal to %d +unpack(): Argument #1 ($format) repeater must be less than or equal to %d diff --git a/tests/std/strings/gh18823_strict.phpt b/tests/std/strings/gh18823_strict.phpt new file mode 100644 index 00000000..e4aa0dbf --- /dev/null +++ b/tests/std/strings/gh18823_strict.phpt @@ -0,0 +1,23 @@ +--TEST-- +GH-18823 (setlocale's 2nd and 3rd argument ignores strict_types) - strict mode +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} +try { + setlocale(LC_ALL, "0", 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +setlocale(): Argument #2 ($locales) must be of type array|string|null, int given +setlocale(): Argument #3 must be of type array|string|null, int given diff --git a/tests/std/strings/gh18823_weak.phpt b/tests/std/strings/gh18823_weak.phpt new file mode 100644 index 00000000..fa085988 --- /dev/null +++ b/tests/std/strings/gh18823_weak.phpt @@ -0,0 +1,35 @@ +--TEST-- +GH-18823 (setlocale's 2nd and 3rd argument ignores strict_types) - weak mode +--SKIPIF-- + +--INI-- +error_reporting=E_ALL +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +no diff --git a/tests/std/strings/gh18897.phpt b/tests/std/strings/gh18897.phpt new file mode 100644 index 00000000..f35bb5a9 --- /dev/null +++ b/tests/std/strings/gh18897.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-18897 (printf: empty precision is interpreted as precision 6, not as precision 0) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +3 +3 diff --git a/tests/std/strings/gh18976.phpt b/tests/std/strings/gh18976.phpt new file mode 100644 index 00000000..099ff94c --- /dev/null +++ b/tests/std/strings/gh18976.phpt @@ -0,0 +1,18 @@ +--TEST-- +GH-18976 (pack overflow with h/H format) +--INI-- +memory_limit=-1 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Warning: pack(): Type h: not enough characters in string in %s on line %d + +Warning: pack(): Type H: not enough characters in string in %s on line %d diff --git a/tests/std/strings/gh19070.phpt b/tests/std/strings/gh19070.phpt new file mode 100644 index 00000000..e4469644 --- /dev/null +++ b/tests/std/strings/gh19070.phpt @@ -0,0 +1,8 @@ +--TEST-- +GH-19070 (setlocale($type, NULL) should not be deprecated) +--FILE-- + +--EXPECTF-- +string(%d) "%s" diff --git a/tests/std/strings/gh20906_1.phpt b/tests/std/strings/gh20906_1.phpt new file mode 100644 index 00000000..fe5cde86 --- /dev/null +++ b/tests/std/strings/gh20906_1.phpt @@ -0,0 +1,29 @@ +--TEST-- +GH-20906 (Assertion failure when messing up output buffers) - php_strip_whitespace +--SKIPIF-- + +--CREDITS-- +vi3tL0u1s +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECTF-- +%a +Fatal error: php_strip_whitespace(): Cannot use output buffering in output buffering display handlers in %s on line %d diff --git a/tests/std/strings/gh20906_2.phpt b/tests/std/strings/gh20906_2.phpt new file mode 100644 index 00000000..c32918b6 --- /dev/null +++ b/tests/std/strings/gh20906_2.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-20906 (Assertion failure when messing up output buffers) - highlight_file +--SKIPIF-- + +--CREDITS-- +vi3tL0u1s +--FILE-- + +--EXPECTF-- +%a +Fatal error: highlight_file(): Cannot use output buffering in output buffering display handlers in %s on line %d diff --git a/tests/std/strings/gh20906_3.phpt b/tests/std/strings/gh20906_3.phpt new file mode 100644 index 00000000..455ca2da --- /dev/null +++ b/tests/std/strings/gh20906_3.phpt @@ -0,0 +1,25 @@ +--TEST-- +GH-20906 (Assertion failure when messing up output buffers) - highlight_string +--SKIPIF-- + +--CREDITS-- +vi3tL0u1s +--FILE-- + +--EXPECTF-- +%a +Fatal error: highlight_string(): Cannot use output buffering in output buffering display handlers in %s on line %d diff --git a/tests/std/strings/hebrev_basic.phpt b/tests/std/strings/hebrev_basic.phpt new file mode 100644 index 00000000..9a6cbedc --- /dev/null +++ b/tests/std/strings/hebrev_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test hebrev() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing hebrev() : basic functionality *** +string(109) ".The hebrev function converts logical Hebrew text to visual text +.The function tries to avoid breaking words +" +string(109) "to visual text +Hebrew text +logical +converts +hebrev function +.The +breaking words +tries to avoid +.The function +" diff --git a/tests/std/strings/hex2bin_basic.phpt b/tests/std/strings/hex2bin_basic.phpt new file mode 100644 index 00000000..c8c54d24 --- /dev/null +++ b/tests/std/strings/hex2bin_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +hex2bin(); function test +--CREDITS-- +edgarsandi - +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/tests/std/strings/hex2bin_error.phpt b/tests/std/strings/hex2bin_error.phpt new file mode 100644 index 00000000..6c418d9e --- /dev/null +++ b/tests/std/strings/hex2bin_error.phpt @@ -0,0 +1,19 @@ +--TEST-- +hex2bin(); function test +--SKIPIF-- + +--CREDITS-- +edgarsandi - +--FILE-- + +--EXPECTF-- +Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d +bool(false) + +Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d +bool(false) diff --git a/tests/std/strings/highlight_file.phpt b/tests/std/strings/highlight_file.phpt new file mode 100644 index 00000000..1ecd8810 --- /dev/null +++ b/tests/std/strings/highlight_file.phpt @@ -0,0 +1,59 @@ +--TEST-- +highlight_file() tests +--SKIPIF-- + +--INI-- +highlight.string=#DD0000 +highlight.comment=#FF9900 +highlight.keyword=#007700 +highlight.default=#0000BB +highlight.html=#000000 +allow_url_include=1 +allow_url_fopen=1 +--FILE-- +')); + +var_dump(highlight_file('data:,')); + +$data = ' +'; + +file_put_contents($filename, $data); +var_dump(highlight_file($filename)); + + +@unlink($filename); +echo "Done\n"; +?> +--EXPECTF-- +Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 + +Warning: highlight_file(%shighlight_file.dat): Failed to open stream: No such file or directory in %s on line %d + +Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d +bool(false) +
<?php echo "test"; ?>
bool(true) +
<?php echo "test ?>
bool(true) +

+<?php
+class test {
+    public $var = 1;
+    private function foo() { echo "foo"; }
+    public function bar() { var_dump(test::foo()); }
+}
+?>
bool(true) +Done diff --git a/tests/std/strings/html_entity_decode1.phpt b/tests/std/strings/html_entity_decode1.phpt new file mode 100644 index 00000000..fb935f87 --- /dev/null +++ b/tests/std/strings/html_entity_decode1.phpt @@ -0,0 +1,68 @@ +--TEST-- +html_entity_decode: Decoding of entities after invalid entities +--FILE-- + html_entity_decode inconsistency","\n", + "$b <-> $a","\n"; + } + } + echo html_entity_decode($ent, ENT_QUOTES, 'UTF-8'), "\n"; +} +echo "Done.\n"; +?> +--EXPECT-- +& +&& +&$ +&#& +&#$ +&#x& +&#x$ +& +$ + & + $ +& +$ +& +$ +&a& +&a$ +&aa& +&aa$ +&aa;& +&aa;$ +&;& +&;$ +Done. diff --git a/tests/std/strings/html_entity_decode2.phpt b/tests/std/strings/html_entity_decode2.phpt new file mode 100644 index 00000000..b900b20b --- /dev/null +++ b/tests/std/strings/html_entity_decode2.phpt @@ -0,0 +1,34 @@ +--TEST-- +html_entity_decode: Handling of ' +--FILE-- + +--EXPECT-- +*** HTML 4.01 implicit (shouldn't decode) *** +' +*** HTML 4.01 (shouldn't decode) *** +' +*** HTML 5 *** +' +*** XHTML 1.0 *** +' +*** XML 1.0 *** +' +Done. diff --git a/tests/std/strings/html_entity_decode3.phpt b/tests/std/strings/html_entity_decode3.phpt new file mode 100644 index 00000000..6b5efd8f --- /dev/null +++ b/tests/std/strings/html_entity_decode3.phpt @@ -0,0 +1,239 @@ +--TEST-- +html_entity_decode: Do not decode numerical entities that refer to non-SGML or otherwise disallowed chars +--FILE-- + +--EXPECT-- +*** HTML 4.01 *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED +' DECODED + NOT DECODED +€ NOT DECODED +Ÿ NOT DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ DECODED +￿ DECODED +﷏ DECODED +﷐ DECODED +﷯ DECODED +ﷰ DECODED +𯿾 DECODED +𯿿 DECODED + +*** XHTML 1.0 *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED +' DECODED + DECODED +€ DECODED +Ÿ DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ NOT DECODED +￿ NOT DECODED +﷏ DECODED +﷐ DECODED +﷯ DECODED +ﷰ DECODED +𯿾 DECODED +𯿿 DECODED + +*** HTML5 *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + NOT DECODED + DECODED +' DECODED + NOT DECODED +€ NOT DECODED +Ÿ NOT DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ NOT DECODED +￿ NOT DECODED +﷏ DECODED +﷐ NOT DECODED +﷯ NOT DECODED +ﷰ DECODED +𯿾 NOT DECODED +𯿿 NOT DECODED + +*** XML 1.0 *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED +' DECODED + DECODED +€ DECODED +Ÿ DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ NOT DECODED +￿ NOT DECODED +﷏ DECODED +﷐ DECODED +﷯ DECODED +ﷰ DECODED +𯿾 DECODED +𯿿 DECODED + +*** Default options *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED +' DECODED + NOT DECODED +€ NOT DECODED +Ÿ NOT DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ DECODED +￿ DECODED +﷏ DECODED +﷐ DECODED +﷯ DECODED +ﷰ DECODED +𯿾 DECODED +𯿿 DECODED + +Done. diff --git a/tests/std/strings/html_entity_decode_cp866.phpt b/tests/std/strings/html_entity_decode_cp866.phpt new file mode 100644 index 00000000..5fd2db6b --- /dev/null +++ b/tests/std/strings/html_entity_decode_cp866.phpt @@ -0,0 +1,532 @@ +--TEST-- +Translation of HTML entities for encoding CP866 +--FILE-- + array(0x80, "CYRILLIC CAPITAL LETTER A"), +0x0411 => array(0x81, "CYRILLIC CAPITAL LETTER BE"), +0x0412 => array(0x82, "CYRILLIC CAPITAL LETTER VE"), +0x0413 => array(0x83, "CYRILLIC CAPITAL LETTER GHE"), +0x0414 => array(0x84, "CYRILLIC CAPITAL LETTER DE"), +0x0415 => array(0x85, "CYRILLIC CAPITAL LETTER IE"), +0x0416 => array(0x86, "CYRILLIC CAPITAL LETTER ZHE"), +0x0417 => array(0x87, "CYRILLIC CAPITAL LETTER ZE"), +0x0418 => array(0x88, "CYRILLIC CAPITAL LETTER I"), +0x0419 => array(0x89, "CYRILLIC CAPITAL LETTER SHORT I"), +0x041a => array(0x8a, "CYRILLIC CAPITAL LETTER KA"), +0x041b => array(0x8b, "CYRILLIC CAPITAL LETTER EL"), +0x041c => array(0x8c, "CYRILLIC CAPITAL LETTER EM"), +0x041d => array(0x8d, "CYRILLIC CAPITAL LETTER EN"), +0x041e => array(0x8e, "CYRILLIC CAPITAL LETTER O"), +0x041f => array(0x8f, "CYRILLIC CAPITAL LETTER PE"), +0x0420 => array(0x90, "CYRILLIC CAPITAL LETTER ER"), +0x0421 => array(0x91, "CYRILLIC CAPITAL LETTER ES"), +0x0422 => array(0x92, "CYRILLIC CAPITAL LETTER TE"), +0x0423 => array(0x93, "CYRILLIC CAPITAL LETTER U"), +0x0424 => array(0x94, "CYRILLIC CAPITAL LETTER EF"), +0x0425 => array(0x95, "CYRILLIC CAPITAL LETTER HA"), +0x0426 => array(0x96, "CYRILLIC CAPITAL LETTER TSE"), +0x0427 => array(0x97, "CYRILLIC CAPITAL LETTER CHE"), +0x0428 => array(0x98, "CYRILLIC CAPITAL LETTER SHA"), +0x0429 => array(0x99, "CYRILLIC CAPITAL LETTER SHCHA"), +0x042a => array(0x9a, "CYRILLIC CAPITAL LETTER HARD SIGN"), +0x042b => array(0x9b, "CYRILLIC CAPITAL LETTER YERU"), +0x042c => array(0x9c, "CYRILLIC CAPITAL LETTER SOFT SIGN"), +0x042d => array(0x9d, "CYRILLIC CAPITAL LETTER E"), +0x042e => array(0x9e, "CYRILLIC CAPITAL LETTER YU"), +0x042f => array(0x9f, "CYRILLIC CAPITAL LETTER YA"), +0x0430 => array(0xa0, "CYRILLIC SMALL LETTER A"), +0x0431 => array(0xa1, "CYRILLIC SMALL LETTER BE"), +0x0432 => array(0xa2, "CYRILLIC SMALL LETTER VE"), +0x0433 => array(0xa3, "CYRILLIC SMALL LETTER GHE"), +0x0434 => array(0xa4, "CYRILLIC SMALL LETTER DE"), +0x0435 => array(0xa5, "CYRILLIC SMALL LETTER IE"), +0x0436 => array(0xa6, "CYRILLIC SMALL LETTER ZHE"), +0x0437 => array(0xa7, "CYRILLIC SMALL LETTER ZE"), +0x0438 => array(0xa8, "CYRILLIC SMALL LETTER I"), +0x0439 => array(0xa9, "CYRILLIC SMALL LETTER SHORT I"), +0x043a => array(0xaa, "CYRILLIC SMALL LETTER KA"), +0x043b => array(0xab, "CYRILLIC SMALL LETTER EL"), +0x043c => array(0xac, "CYRILLIC SMALL LETTER EM"), +0x043d => array(0xad, "CYRILLIC SMALL LETTER EN"), +0x043e => array(0xae, "CYRILLIC SMALL LETTER O"), +0x043f => array(0xaf, "CYRILLIC SMALL LETTER PE"), +0x2591 => array(0xb0, "LIGHT SHADE"), +0x2592 => array(0xb1, "MEDIUM SHADE"), +0x2593 => array(0xb2, "DARK SHADE"), +0x2502 => array(0xb3, "BOX DRAWINGS LIGHT VERTICAL"), +0x2524 => array(0xb4, "BOX DRAWINGS LIGHT VERTICAL AND LEFT"), +0x2561 => array(0xb5, "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE"), +0x2562 => array(0xb6, "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE"), +0x2556 => array(0xb7, "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE"), +0x2555 => array(0xb8, "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE"), +0x2563 => array(0xb9, "BOX DRAWINGS DOUBLE VERTICAL AND LEFT"), +0x2551 => array(0xba, "BOX DRAWINGS DOUBLE VERTICAL"), +0x2557 => array(0xbb, "BOX DRAWINGS DOUBLE DOWN AND LEFT"), +0x255d => array(0xbc, "BOX DRAWINGS DOUBLE UP AND LEFT"), +0x255c => array(0xbd, "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE"), +0x255b => array(0xbe, "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE"), +0x2510 => array(0xbf, "BOX DRAWINGS LIGHT DOWN AND LEFT"), +0x2514 => array(0xc0, "BOX DRAWINGS LIGHT UP AND RIGHT"), +0x2534 => array(0xc1, "BOX DRAWINGS LIGHT UP AND HORIZONTAL"), +0x252c => array(0xc2, "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL"), +0x251c => array(0xc3, "BOX DRAWINGS LIGHT VERTICAL AND RIGHT"), +0x2500 => array(0xc4, "BOX DRAWINGS LIGHT HORIZONTAL"), +0x253c => array(0xc5, "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL"), +0x255e => array(0xc6, "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE"), +0x255f => array(0xc7, "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE"), +0x255a => array(0xc8, "BOX DRAWINGS DOUBLE UP AND RIGHT"), +0x2554 => array(0xc9, "BOX DRAWINGS DOUBLE DOWN AND RIGHT"), +0x2569 => array(0xca, "BOX DRAWINGS DOUBLE UP AND HORIZONTAL"), +0x2566 => array(0xcb, "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL"), +0x2560 => array(0xcc, "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT"), +0x2550 => array(0xcd, "BOX DRAWINGS DOUBLE HORIZONTAL"), +0x256c => array(0xce, "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL"), +0x2567 => array(0xcf, "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE"), +0x2568 => array(0xd0, "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE"), +0x2564 => array(0xd1, "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE"), +0x2565 => array(0xd2, "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE"), +0x2559 => array(0xd3, "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE"), +0x2558 => array(0xd4, "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE"), +0x2552 => array(0xd5, "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE"), +0x2553 => array(0xd6, "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE"), +0x256b => array(0xd7, "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE"), +0x256a => array(0xd8, "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE"), +0x2518 => array(0xd9, "BOX DRAWINGS LIGHT UP AND LEFT"), +0x250c => array(0xda, "BOX DRAWINGS LIGHT DOWN AND RIGHT"), +0x2588 => array(0xdb, "FULL BLOCK"), +0x2584 => array(0xdc, "LOWER HALF BLOCK"), +0x258c => array(0xdd, "LEFT HALF BLOCK"), +0x2590 => array(0xde, "RIGHT HALF BLOCK"), +0x2580 => array(0xdf, "UPPER HALF BLOCK"), +0x0440 => array(0xe0, "CYRILLIC SMALL LETTER ER"), +0x0441 => array(0xe1, "CYRILLIC SMALL LETTER ES"), +0x0442 => array(0xe2, "CYRILLIC SMALL LETTER TE"), +0x0443 => array(0xe3, "CYRILLIC SMALL LETTER U"), +0x0444 => array(0xe4, "CYRILLIC SMALL LETTER EF"), +0x0445 => array(0xe5, "CYRILLIC SMALL LETTER HA"), +0x0446 => array(0xe6, "CYRILLIC SMALL LETTER TSE"), +0x0447 => array(0xe7, "CYRILLIC SMALL LETTER CHE"), +0x0448 => array(0xe8, "CYRILLIC SMALL LETTER SHA"), +0x0449 => array(0xe9, "CYRILLIC SMALL LETTER SHCHA"), +0x044a => array(0xea, "CYRILLIC SMALL LETTER HARD SIGN"), +0x044b => array(0xeb, "CYRILLIC SMALL LETTER YERU"), +0x044c => array(0xec, "CYRILLIC SMALL LETTER SOFT SIGN"), +0x044d => array(0xed, "CYRILLIC SMALL LETTER E"), +0x044e => array(0xee, "CYRILLIC SMALL LETTER YU"), +0x044f => array(0xef, "CYRILLIC SMALL LETTER YA"), +0x0401 => array(0xf0, "CYRILLIC CAPITAL LETTER IO"), +0x0451 => array(0xf1, "CYRILLIC SMALL LETTER IO"), +0x0404 => array(0xf2, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"), +0x0454 => array(0xf3, "CYRILLIC SMALL LETTER UKRAINIAN IE"), +0x0407 => array(0xf4, "CYRILLIC CAPITAL LETTER YI"), +0x0457 => array(0xf5, "CYRILLIC SMALL LETTER YI"), +0x040e => array(0xf6, "CYRILLIC CAPITAL LETTER SHORT U"), +0x045e => array(0xf7, "CYRILLIC SMALL LETTER SHORT U"), +0x00b0 => array(0xf8, "DEGREE SIGN"), +0x2219 => array(0xf9, "BULLET OPERATOR"), +0x00b7 => array(0xfa, "MIDDLE DOT"), +0x221a => array(0xfb, "SQUARE ROOT"), +0x2116 => array(0xfc, "NUMERO SIGN"), +0x00a4 => array(0xfd, "CURRENCY SIGN"), +0x25a0 => array(0xfe, "BLACK SQUARE"), +0x00a0 => array(0xff, "NO-BREAK SPACE"), +); + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'CP866'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'CP866'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +CYRILLIC CAPITAL LETTER A: А => 80 +€ => € + +CYRILLIC CAPITAL LETTER BE: Б => 81 + =>  + +CYRILLIC CAPITAL LETTER VE: В => 82 +‚ => ‚ + +CYRILLIC CAPITAL LETTER GHE: Г => 83 +ƒ => ƒ + +CYRILLIC CAPITAL LETTER DE: Д => 84 +„ => „ + +CYRILLIC CAPITAL LETTER IE: Е => 85 +… => … + +CYRILLIC CAPITAL LETTER ZHE: Ж => 86 +† => † + +CYRILLIC CAPITAL LETTER ZE: З => 87 +‡ => ‡ + +CYRILLIC CAPITAL LETTER I: И => 88 +ˆ => ˆ + +CYRILLIC CAPITAL LETTER SHORT I: Й => 89 +‰ => ‰ + +CYRILLIC CAPITAL LETTER KA: К => 8a +Š => Š + +CYRILLIC CAPITAL LETTER EL: Л => 8b +‹ => ‹ + +CYRILLIC CAPITAL LETTER EM: М => 8c +Œ => Œ + +CYRILLIC CAPITAL LETTER EN: Н => 8d + =>  + +CYRILLIC CAPITAL LETTER O: О => 8e +Ž => Ž + +CYRILLIC CAPITAL LETTER PE: П => 8f + =>  + +CYRILLIC CAPITAL LETTER ER: Р => 90 + =>  + +CYRILLIC CAPITAL LETTER ES: С => 91 +‘ => ‘ + +CYRILLIC CAPITAL LETTER TE: Т => 92 +’ => ’ + +CYRILLIC CAPITAL LETTER U: У => 93 +“ => “ + +CYRILLIC CAPITAL LETTER EF: Ф => 94 +” => ” + +CYRILLIC CAPITAL LETTER HA: Х => 95 +• => • + +CYRILLIC CAPITAL LETTER TSE: Ц => 96 +– => – + +CYRILLIC CAPITAL LETTER CHE: Ч => 97 +— => — + +CYRILLIC CAPITAL LETTER SHA: Ш => 98 +˜ => ˜ + +CYRILLIC CAPITAL LETTER SHCHA: Щ => 99 +™ => ™ + +CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => 9a +š => š + +CYRILLIC CAPITAL LETTER YERU: Ы => 9b +› => › + +CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => 9c +œ => œ + +CYRILLIC CAPITAL LETTER E: Э => 9d + =>  + +CYRILLIC CAPITAL LETTER YU: Ю => 9e +ž => ž + +CYRILLIC CAPITAL LETTER YA: Я => 9f +Ÿ => Ÿ + +CYRILLIC SMALL LETTER A: а => a0 +  => ff + +CYRILLIC SMALL LETTER BE: б => a1 +¡ => ¡ + +CYRILLIC SMALL LETTER VE: в => a2 +¢ => ¢ + +CYRILLIC SMALL LETTER GHE: г => a3 +£ => £ + +CYRILLIC SMALL LETTER DE: д => a4 +¤ => fd + +CYRILLIC SMALL LETTER IE: е => a5 +¥ => ¥ + +CYRILLIC SMALL LETTER ZHE: ж => a6 +¦ => ¦ + +CYRILLIC SMALL LETTER ZE: з => a7 +§ => § + +CYRILLIC SMALL LETTER I: и => a8 +¨ => ¨ + +CYRILLIC SMALL LETTER SHORT I: й => a9 +© => © + +CYRILLIC SMALL LETTER KA: к => aa +ª => ª + +CYRILLIC SMALL LETTER EL: л => ab +« => « + +CYRILLIC SMALL LETTER EM: м => ac +¬ => ¬ + +CYRILLIC SMALL LETTER EN: н => ad +­ => ­ + +CYRILLIC SMALL LETTER O: о => ae +® => ® + +CYRILLIC SMALL LETTER PE: п => af +¯ => ¯ + +LIGHT SHADE: ░ => b0 +° => f8 + +MEDIUM SHADE: ▒ => b1 +± => ± + +DARK SHADE: ▓ => b2 +² => ² + +BOX DRAWINGS LIGHT VERTICAL: │ => b3 +³ => ³ + +BOX DRAWINGS LIGHT VERTICAL AND LEFT: ┤ => b4 +´ => ´ + +BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE: ╡ => b5 +µ => µ + +BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE: ╢ => b6 +¶ => ¶ + +BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE: ╖ => b7 +· => fa + +BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE: ╕ => b8 +¸ => ¸ + +BOX DRAWINGS DOUBLE VERTICAL AND LEFT: ╣ => b9 +¹ => ¹ + +BOX DRAWINGS DOUBLE VERTICAL: ║ => ba +º => º + +BOX DRAWINGS DOUBLE DOWN AND LEFT: ╗ => bb +» => » + +BOX DRAWINGS DOUBLE UP AND LEFT: ╝ => bc +¼ => ¼ + +BOX DRAWINGS UP DOUBLE AND LEFT SINGLE: ╜ => bd +½ => ½ + +BOX DRAWINGS UP SINGLE AND LEFT DOUBLE: ╛ => be +¾ => ¾ + +BOX DRAWINGS LIGHT DOWN AND LEFT: ┐ => bf +¿ => ¿ + +BOX DRAWINGS LIGHT UP AND RIGHT: └ => c0 +À => À + +BOX DRAWINGS LIGHT UP AND HORIZONTAL: ┴ => c1 +Á => Á + +BOX DRAWINGS LIGHT DOWN AND HORIZONTAL: ┬ => c2 + =>  + +BOX DRAWINGS LIGHT VERTICAL AND RIGHT: ├ => c3 +à => à + +BOX DRAWINGS LIGHT HORIZONTAL: ─ => c4 +Ä => Ä + +BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL: ┼ => c5 +Å => Å + +BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE: ╞ => c6 +Æ => Æ + +BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE: ╟ => c7 +Ç => Ç + +BOX DRAWINGS DOUBLE UP AND RIGHT: ╚ => c8 +È => È + +BOX DRAWINGS DOUBLE DOWN AND RIGHT: ╔ => c9 +É => É + +BOX DRAWINGS DOUBLE UP AND HORIZONTAL: ╩ => ca +Ê => Ê + +BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL: ╦ => cb +Ë => Ë + +BOX DRAWINGS DOUBLE VERTICAL AND RIGHT: ╠ => cc +Ì => Ì + +BOX DRAWINGS DOUBLE HORIZONTAL: ═ => cd +Í => Í + +BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: ╬ => ce +Î => Î + +BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE: ╧ => cf +Ï => Ï + +BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE: ╨ => d0 +Ð => Ð + +BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE: ╤ => d1 +Ñ => Ñ + +BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE: ╥ => d2 +Ò => Ò + +BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE: ╙ => d3 +Ó => Ó + +BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE: ╘ => d4 +Ô => Ô + +BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE: ╒ => d5 +Õ => Õ + +BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE: ╓ => d6 +Ö => Ö + +BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE: ╫ => d7 +× => × + +BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE: ╪ => d8 +Ø => Ø + +BOX DRAWINGS LIGHT UP AND LEFT: ┘ => d9 +Ù => Ù + +BOX DRAWINGS LIGHT DOWN AND RIGHT: ┌ => da +Ú => Ú + +FULL BLOCK: █ => db +Û => Û + +LOWER HALF BLOCK: ▄ => dc +Ü => Ü + +LEFT HALF BLOCK: ▌ => dd +Ý => Ý + +RIGHT HALF BLOCK: ▐ => de +Þ => Þ + +UPPER HALF BLOCK: ▀ => df +ß => ß + +CYRILLIC SMALL LETTER ER: р => e0 +à => à + +CYRILLIC SMALL LETTER ES: с => e1 +á => á + +CYRILLIC SMALL LETTER TE: т => e2 +â => â + +CYRILLIC SMALL LETTER U: у => e3 +ã => ã + +CYRILLIC SMALL LETTER EF: ф => e4 +ä => ä + +CYRILLIC SMALL LETTER HA: х => e5 +å => å + +CYRILLIC SMALL LETTER TSE: ц => e6 +æ => æ + +CYRILLIC SMALL LETTER CHE: ч => e7 +ç => ç + +CYRILLIC SMALL LETTER SHA: ш => e8 +è => è + +CYRILLIC SMALL LETTER SHCHA: щ => e9 +é => é + +CYRILLIC SMALL LETTER HARD SIGN: ъ => ea +ê => ê + +CYRILLIC SMALL LETTER YERU: ы => eb +ë => ë + +CYRILLIC SMALL LETTER SOFT SIGN: ь => ec +ì => ì + +CYRILLIC SMALL LETTER E: э => ed +í => í + +CYRILLIC SMALL LETTER YU: ю => ee +î => î + +CYRILLIC SMALL LETTER YA: я => ef +ï => ï + +CYRILLIC CAPITAL LETTER IO: Ё => f0 +ð => ð + +CYRILLIC SMALL LETTER IO: ё => f1 +ñ => ñ + +CYRILLIC CAPITAL LETTER UKRAINIAN IE: Є => f2 +ò => ò + +CYRILLIC SMALL LETTER UKRAINIAN IE: є => f3 +ó => ó + +CYRILLIC CAPITAL LETTER YI: Ї => f4 +ô => ô + +CYRILLIC SMALL LETTER YI: ї => f5 +õ => õ + +CYRILLIC CAPITAL LETTER SHORT U: Ў => f6 +ö => ö + +CYRILLIC SMALL LETTER SHORT U: ў => f7 +÷ => ÷ + +DEGREE SIGN: ° => f8 +ø => ø + +BULLET OPERATOR: ∙ => f9 +ù => ù + +MIDDLE DOT: · => fa +ú => ú + +SQUARE ROOT: √ => fb +û => û + +NUMERO SIGN: № => fc +ü => ü + +CURRENCY SIGN: ¤ => fd +ý => ý + +BLACK SQUARE: ■ => fe +þ => þ + +NO-BREAK SPACE:   => ff +ÿ => ÿ diff --git a/tests/std/strings/html_entity_decode_html4.phpt b/tests/std/strings/html_entity_decode_html4.phpt new file mode 100644 index 00000000..dad8a3eb --- /dev/null +++ b/tests/std/strings/html_entity_decode_html4.phpt @@ -0,0 +1,516 @@ +--TEST-- +html_entity_decode() conformance check (HTML 4) +--FILE-- + +--EXPECT-- +22 +26 +3c +3e +c2a0 +c2a1 +c2a2 +c2a3 +c2a4 +c2a5 +c2a6 +c2a7 +c2a8 +c2a9 +c2aa +c2ab +c2ac +c2ad +c2ae +c2af +c2b0 +c2b1 +c2b2 +c2b3 +c2b4 +c2b5 +c2b6 +c2b7 +c2b8 +c2b9 +c2ba +c2bb +c2bc +c2bd +c2be +c2bf +c380 +c381 +c382 +c383 +c384 +c385 +c386 +c387 +c388 +c389 +c38a +c38b +c38c +c38d +c38e +c38f +c390 +c391 +c392 +c393 +c394 +c395 +c396 +c397 +c398 +c399 +c39a +c39b +c39c +c39d +c39e +c39f +c3a0 +c3a1 +c3a2 +c3a3 +c3a4 +c3a5 +c3a6 +c3a7 +c3a8 +c3a9 +c3aa +c3ab +c3ac +c3ad +c3ae +c3af +c3b0 +c3b1 +c3b2 +c3b3 +c3b4 +c3b5 +c3b6 +c3b7 +c3b8 +c3b9 +c3ba +c3bb +c3bc +c3bd +c3be +c3bf +c592 +c593 +c5a0 +c5a1 +c5b8 +c692 +cb86 +cb9c +ce91 +ce92 +ce93 +ce94 +ce95 +ce96 +ce97 +ce98 +ce99 +ce9a +ce9b +ce9c +ce9d +ce9e +ce9f +cea0 +cea1 +cea3 +cea4 +cea5 +cea6 +cea7 +cea8 +cea9 +ceb1 +ceb2 +ceb3 +ceb4 +ceb5 +ceb6 +ceb7 +ceb8 +ceb9 +ceba +cebb +cebc +cebd +cebe +cebf +cf80 +cf81 +cf82 +cf83 +cf84 +cf85 +cf86 +cf87 +cf88 +cf89 +cf91 +cf92 +cf96 +e28082 +e28083 +e28089 +e2808c +e2808d +e2808e +e2808f +e28093 +e28094 +e28098 +e28099 +e2809a +e2809c +e2809d +e2809e +e280a0 +e280a1 +e280a2 +e280a6 +e280b0 +e280b2 +e280b3 +e280b9 +e280ba +e280be +e28184 +e282ac +e28491 +e28498 +e2849c +e284a2 +e284b5 +e28690 +e28691 +e28692 +e28693 +e28694 +e286b5 +e28790 +e28791 +e28792 +e28793 +e28794 +e28880 +e28882 +e28883 +e28885 +e28887 +e28888 +e28889 +e2888b +e2888f +e28891 +e28892 +e28897 +e2889a +e2889d +e2889e +e288a0 +e288a7 +e288a8 +e288a9 +e288aa +e288ab +e288b4 +e288bc +e28985 +e28988 +e289a0 +e289a1 +e289a4 +e289a5 +e28a82 +e28a83 +e28a84 +e28a86 +e28a87 +e28a95 +e28a97 +e28aa5 +e28b85 +e28c88 +e28c89 +e28c8a +e28c8b +e28ca9 +e28caa +e2978a +e299a0 +e299a3 +e299a5 +e299a6 diff --git a/tests/std/strings/html_entity_decode_html5.phpt b/tests/std/strings/html_entity_decode_html5.phpt new file mode 100644 index 00000000..81f692c5 --- /dev/null +++ b/tests/std/strings/html_entity_decode_html5.phpt @@ -0,0 +1,4264 @@ +--TEST-- +html_entity_decode() conformance check (HTML 5) +--FILE-- + $de ", bin2hex($de), "\n"; +} +?> +--EXPECT-- +Æ => Æ c386 +& => & 26 +Á => à c381 +Ă => Ä‚ c482 + =>  c382 +А => Ð d090 +𝔄 => 𔄠f09d9484 +À => À c380 +Α => Α ce91 +Ā => Ä€ c480 +⩓ => â©“ e2a993 +Ą => Ä„ c484 +𝔸 => 𔸠f09d94b8 +⁡ => â¡ e281a1 +Å => Ã… c385 +𝒜 => 𒜠f09d929c +≔ => ≔ e28994 +à => à c383 +Ä => Ä c384 +∖ => ∖ e28896 +⫧ => â«§ e2aba7 +⌆ => ⌆ e28c86 +Б => Б d091 +∵ => ∵ e288b5 +ℬ => ℬ e284ac +Β => Î’ ce92 +𝔅 => ð”… f09d9485 +𝔹 => 𔹠f09d94b9 +˘ => ˘ cb98 +ℬ => ℬ e284ac +≎ => ≎ e2898e +Ч => Ч d0a7 +© => © c2a9 +Ć => Ć c486 +⋒ => â‹’ e28b92 +ⅅ => â…… e28585 +ℭ => â„­ e284ad +Č => ÄŒ c48c +Ç => Ç c387 +Ĉ => Ĉ c488 +∰ => ∰ e288b0 +Ċ => ÄŠ c48a +¸ => ¸ c2b8 +· => · c2b7 +ℭ => â„­ e284ad +Χ => Χ cea7 +⊙ => ⊙ e28a99 +⊖ => ⊖ e28a96 +⊕ => ⊕ e28a95 +⊗ => ⊗ e28a97 +∲ => ∲ e288b2 +” => †e2809d +’ => ’ e28099 +∷ => ∷ e288b7 +⩴ => â©´ e2a9b4 +≡ => ≡ e289a1 +∯ => ∯ e288af +∮ => ∮ e288ae +ℂ => â„‚ e28482 +∐ => ∠e28890 +∳ => ∳ e288b3 +⨯ => ⨯ e2a8af +𝒞 => ð’ž f09d929e +⋓ => â‹“ e28b93 +≍ => ≠e2898d +ⅅ => â…… e28585 +⤑ => ⤑ e2a491 +Ђ => Ђ d082 +Ѕ => Ð… d085 +Џ => Ð d08f +‡ => ‡ e280a1 +↡ => ↡ e286a1 +⫤ => ⫤ e2aba4 +Ď => ÄŽ c48e +Д => Д d094 +∇ => ∇ e28887 +Δ => Δ ce94 +𝔇 => 𔇠f09d9487 +´ => ´ c2b4 +˙ => Ë™ cb99 +˝ => Ë cb9d +` => ` 60 +˜ => Ëœ cb9c +⋄ => â‹„ e28b84 +ⅆ => â…† e28586 +𝔻 => ð”» f09d94bb +¨ => ¨ c2a8 +⃜ => ⃜ e2839c +≐ => ≠e28990 +∯ => ∯ e288af +¨ => ¨ c2a8 +⇓ => ⇓ e28793 +⇐ => ⇠e28790 +⇔ => ⇔ e28794 +⫤ => ⫤ e2aba4 +⟸ => ⟸ e29fb8 +⟺ => ⟺ e29fba +⟹ => ⟹ e29fb9 +⇒ => ⇒ e28792 +⊨ => ⊨ e28aa8 +⇑ => ⇑ e28791 +⇕ => ⇕ e28795 +∥ => ∥ e288a5 +↓ => ↓ e28693 +⤓ => ⤓ e2a493 +⇵ => ⇵ e287b5 +̑ => Ì‘ cc91 +⥐ => ⥠e2a590 +⥞ => ⥞ e2a59e +↽ => ↽ e286bd +⥖ => ⥖ e2a596 +⥟ => ⥟ e2a59f +⇁ => ⇠e28781 +⥗ => ⥗ e2a597 +⊤ => ⊤ e28aa4 +↧ => ↧ e286a7 +⇓ => ⇓ e28793 +𝒟 => ð’Ÿ f09d929f +Đ => Ä c490 +Ŋ => ÅŠ c58a +Ð => à c390 +É => É c389 +Ě => Äš c49a +Ê => Ê c38a +Э => Э d0ad +Ė => Ä– c496 +𝔈 => 𔈠f09d9488 +È => È c388 +∈ => ∈ e28888 +Ē => Ä’ c492 +◻ => â—» e297bb +▫ => â–« e296ab +Ę => Ę c498 +𝔼 => 𔼠f09d94bc +Ε => Ε ce95 +⩵ => ⩵ e2a9b5 +≂ => ≂ e28982 +⇌ => ⇌ e2878c +ℰ => â„° e284b0 +⩳ => ⩳ e2a9b3 +Η => Η ce97 +Ë => Ë c38b +∃ => ∃ e28883 +ⅇ => â…‡ e28587 +Ф => Ф d0a4 +𝔉 => 𔉠f09d9489 +◼ => â—¼ e297bc +▪ => â–ª e296aa +𝔽 => 𔽠f09d94bd +∀ => ∀ e28880 +ℱ => ℱ e284b1 +ℱ => ℱ e284b1 +Ѓ => Ѓ d083 +> => > 3e +Γ => Γ ce93 +Ϝ => Ïœ cf9c +Ğ => Äž c49e +Ģ => Ä¢ c4a2 +Ĝ => Äœ c49c +Г => Г d093 +Ġ => Ä  c4a0 +𝔊 => 𔊠f09d948a +⋙ => â‹™ e28b99 +𝔾 => 𔾠f09d94be +≥ => ≥ e289a5 +⋛ => â‹› e28b9b +≧ => ≧ e289a7 +⪢ => ⪢ e2aaa2 +≷ => ≷ e289b7 +⩾ => ⩾ e2a9be +≳ => ≳ e289b3 +𝒢 => ð’¢ f09d92a2 +≫ => ≫ e289ab +Ъ => Ъ d0aa +ˇ => ˇ cb87 +^ => ^ 5e +Ĥ => Ĥ c4a4 +ℌ => ℌ e2848c +ℋ => â„‹ e2848b +ℍ => â„ e2848d +─ => ─ e29480 +ℋ => â„‹ e2848b +Ħ => Ħ c4a6 +≎ => ≎ e2898e +≏ => ≠e2898f +Е => Е d095 +IJ => IJ c4b2 +Ё => Ð d081 +Í => à c38d +Î => ÃŽ c38e +И => И d098 +İ => İ c4b0 +ℑ => â„‘ e28491 +Ì => ÃŒ c38c +ℑ => â„‘ e28491 +Ī => Ī c4aa +ⅈ => â…ˆ e28588 +⇒ => ⇒ e28792 +∬ => ∬ e288ac +∫ => ∫ e288ab +⋂ => â‹‚ e28b82 +⁣ => ⣠e281a3 +⁢ => ⢠e281a2 +Į => Ä® c4ae +𝕀 => ð•€ f09d9580 +Ι => Ι ce99 +ℐ => â„ e28490 +Ĩ => Ĩ c4a8 +І => І d086 +Ï => à c38f +Ĵ => Ä´ c4b4 +Й => Й d099 +𝔍 => ð” f09d948d +𝕁 => ð• f09d9581 +𝒥 => ð’¥ f09d92a5 +Ј => Ј d088 +Є => Є d084 +Х => Ð¥ d0a5 +Ќ => ÐŒ d08c +Κ => Κ ce9a +Ķ => Ķ c4b6 +К => К d09a +𝔎 => 𔎠f09d948e +𝕂 => ð•‚ f09d9582 +𝒦 => ð’¦ f09d92a6 +Љ => Љ d089 +< => < 3c +Ĺ => Ĺ c4b9 +Λ => Λ ce9b +⟪ => ⟪ e29faa +ℒ => â„’ e28492 +↞ => ↞ e2869e +Ľ => Ľ c4bd +Ļ => Ä» c4bb +Л => Л d09b +⟨ => ⟨ e29fa8 +← => ↠e28690 +⇤ => ⇤ e287a4 +⇆ => ⇆ e28786 +⌈ => ⌈ e28c88 +⟦ => ⟦ e29fa6 +⥡ => ⥡ e2a5a1 +⇃ => ⇃ e28783 +⥙ => ⥙ e2a599 +⌊ => ⌊ e28c8a +↔ => ↔ e28694 +⥎ => ⥎ e2a58e +⊣ => ⊣ e28aa3 +↤ => ↤ e286a4 +⥚ => ⥚ e2a59a +⊲ => ⊲ e28ab2 +⧏ => â§ e2a78f +⊴ => ⊴ e28ab4 +⥑ => ⥑ e2a591 +⥠ => ⥠ e2a5a0 +↿ => ↿ e286bf +⥘ => ⥘ e2a598 +↼ => ↼ e286bc +⥒ => ⥒ e2a592 +⇐ => ⇠e28790 +⇔ => ⇔ e28794 +⋚ => ⋚ e28b9a +≦ => ≦ e289a6 +≶ => ≶ e289b6 +⪡ => ⪡ e2aaa1 +⩽ => ⩽ e2a9bd +≲ => ≲ e289b2 +𝔏 => ð” f09d948f +⋘ => ⋘ e28b98 +⇚ => ⇚ e2879a +Ŀ => Ä¿ c4bf +⟵ => ⟵ e29fb5 +⟷ => ⟷ e29fb7 +⟶ => ⟶ e29fb6 +⟸ => ⟸ e29fb8 +⟺ => ⟺ e29fba +⟹ => ⟹ e29fb9 +𝕃 => 𕃠f09d9583 +↙ => ↙ e28699 +↘ => ↘ e28698 +ℒ => â„’ e28492 +↰ => ↰ e286b0 +Ł => Å c581 +≪ => ≪ e289aa +⤅ => ⤅ e2a485 +М => М d09c +  => ⟠e2819f +ℳ => ℳ e284b3 +𝔐 => ð” f09d9490 +∓ => ∓ e28893 +𝕄 => ð•„ f09d9584 +ℳ => ℳ e284b3 +Μ => Μ ce9c +Њ => Њ d08a +Ń => Ń c583 +Ň => Ň c587 +Ņ => Å… c585 +Н => Ð d09d +​ => ​ e2808b +​ => ​ e2808b +​ => ​ e2808b +​ => ​ e2808b +≫ => ≫ e289ab +≪ => ≪ e289aa + => + 0a +𝔑 => 𔑠f09d9491 +⁠ => â  e281a0 +  =>   c2a0 +ℕ => â„• e28495 +⫬ => ⫬ e2abac +≢ => ≢ e289a2 +≭ => ≭ e289ad +∦ => ∦ e288a6 +∉ => ∉ e28889 +≠ => ≠ e289a0 +≂̸ => ≂̸ e28982ccb8 +∄ => ∄ e28884 +≯ => ≯ e289af +≱ => ≱ e289b1 +≧̸ => ≧̸ e289a7ccb8 +≫̸ => ≫̸ e289abccb8 +≹ => ≹ e289b9 +⩾̸ => ⩾̸ e2a9beccb8 +≵ => ≵ e289b5 +≎̸ => ≎̸ e2898eccb8 +≏̸ => â‰Ì¸ e2898fccb8 +⋪ => ⋪ e28baa +⧏̸ => â§Ì¸ e2a78fccb8 +⋬ => ⋬ e28bac +≮ => ≮ e289ae +≰ => ≰ e289b0 +≸ => ≸ e289b8 +≪̸ => ≪̸ e289aaccb8 +⩽̸ => ⩽̸ e2a9bdccb8 +≴ => ≴ e289b4 +⪢̸ => ⪢̸ e2aaa2ccb8 +⪡̸ => ⪡̸ e2aaa1ccb8 +⊀ => ⊀ e28a80 +⪯̸ => ⪯̸ e2aaafccb8 +⋠ => â‹  e28ba0 +∌ => ∌ e2888c +⋫ => â‹« e28bab +⧐̸ => â§Ì¸ e2a790ccb8 +⋭ => â‹­ e28bad +⊏̸ => âŠÌ¸ e28a8fccb8 +⋢ => â‹¢ e28ba2 +⊐̸ => âŠÌ¸ e28a90ccb8 +⋣ => â‹£ e28ba3 +⊂⃒ => ⊂⃒ e28a82e28392 +⊈ => ⊈ e28a88 +⊁ => ⊠e28a81 +⪰̸ => ⪰̸ e2aab0ccb8 +⋡ => â‹¡ e28ba1 +≿̸ => ≿̸ e289bfccb8 +⊃⃒ => ⊃⃒ e28a83e28392 +⊉ => ⊉ e28a89 +≁ => ≠e28981 +≄ => ≄ e28984 +≇ => ≇ e28987 +≉ => ≉ e28989 +∤ => ∤ e288a4 +𝒩 => ð’© f09d92a9 +Ñ => Ñ c391 +Ν => Î ce9d +Œ => Å’ c592 +Ó => Ó c393 +Ô => Ô c394 +О => О d09e +Ő => Å c590 +𝔒 => ð”’ f09d9492 +Ò => Ã’ c392 +Ō => ÅŒ c58c +Ω => Ω cea9 +Ο => Ο ce9f +𝕆 => 𕆠f09d9586 +“ => “ e2809c +‘ => ‘ e28098 +⩔ => â©” e2a994 +𝒪 => ð’ª f09d92aa +Ø => Ø c398 +Õ => Õ c395 +⨷ => ⨷ e2a8b7 +Ö => Ö c396 +‾ => ‾ e280be +⏞ => âž e28f9e +⎴ => ⎴ e28eb4 +⏜ => ✠e28f9c +∂ => ∂ e28882 +П => П d09f +𝔓 => 𔓠f09d9493 +Φ => Φ cea6 +Π => Π cea0 +± => ± c2b1 +ℌ => ℌ e2848c +ℙ => â„™ e28499 +⪻ => ⪻ e2aabb +≺ => ≺ e289ba +⪯ => ⪯ e2aaaf +≼ => ≼ e289bc +≾ => ≾ e289be +″ => ″ e280b3 +∏ => ∠e2888f +∷ => ∷ e288b7 +∝ => ∠e2889d +𝒫 => ð’« f09d92ab +Ψ => Ψ cea8 +" => " 22 +𝔔 => ð”” f09d9494 +ℚ => ℚ e2849a +𝒬 => ð’¬ f09d92ac +⤐ => ⤠e2a490 +® => ® c2ae +Ŕ => Å” c594 +⟫ => ⟫ e29fab +↠ => ↠ e286a0 +⤖ => ⤖ e2a496 +Ř => Ř c598 +Ŗ => Å– c596 +Р => Р d0a0 +ℜ => ℜ e2849c +∋ => ∋ e2888b +⇋ => ⇋ e2878b +⥯ => ⥯ e2a5af +ℜ => ℜ e2849c +Ρ => Ρ cea1 +⟩ => ⟩ e29fa9 +→ => → e28692 +⇥ => ⇥ e287a5 +⇄ => ⇄ e28784 +⌉ => ⌉ e28c89 +⟧ => ⟧ e29fa7 +⥝ => ⥠e2a59d +⇂ => ⇂ e28782 +⥕ => ⥕ e2a595 +⌋ => ⌋ e28c8b +⊢ => ⊢ e28aa2 +↦ => ↦ e286a6 +⥛ => ⥛ e2a59b +⊳ => ⊳ e28ab3 +⧐ => â§ e2a790 +⊵ => ⊵ e28ab5 +⥏ => ⥠e2a58f +⥜ => ⥜ e2a59c +↾ => ↾ e286be +⥔ => ⥔ e2a594 +⇀ => ⇀ e28780 +⥓ => ⥓ e2a593 +⇒ => ⇒ e28792 +ℝ => â„ e2849d +⥰ => ⥰ e2a5b0 +⇛ => ⇛ e2879b +ℛ => â„› e2849b +↱ => ↱ e286b1 +⧴ => â§´ e2a7b4 +Щ => Щ d0a9 +Ш => Ш d0a8 +Ь => Ь d0ac +Ś => Åš c59a +⪼ => ⪼ e2aabc +Š => Å  c5a0 +Ş => Åž c59e +Ŝ => Åœ c59c +С => С d0a1 +𝔖 => ð”– f09d9496 +↓ => ↓ e28693 +← => ↠e28690 +→ => → e28692 +↑ => ↑ e28691 +Σ => Σ cea3 +∘ => ∘ e28898 +𝕊 => 𕊠f09d958a +√ => √ e2889a +□ => â–¡ e296a1 +⊓ => ⊓ e28a93 +⊏ => ⊠e28a8f +⊑ => ⊑ e28a91 +⊐ => ⊠e28a90 +⊒ => ⊒ e28a92 +⊔ => ⊔ e28a94 +𝒮 => ð’® f09d92ae +⋆ => ⋆ e28b86 +⋐ => â‹ e28b90 +⋐ => â‹ e28b90 +⊆ => ⊆ e28a86 +≻ => ≻ e289bb +⪰ => ⪰ e2aab0 +≽ => ≽ e289bd +≿ => ≿ e289bf +∋ => ∋ e2888b +∑ => ∑ e28891 +⋑ => â‹‘ e28b91 +⊃ => ⊃ e28a83 +⊇ => ⊇ e28a87 +⋑ => â‹‘ e28b91 +Þ => Þ c39e +™ => â„¢ e284a2 +Ћ => Ћ d08b +Ц => Ц d0a6 + => 09 +Τ => Τ cea4 +Ť => Ť c5a4 +Ţ => Å¢ c5a2 +Т => Т d0a2 +𝔗 => ð”— f09d9497 +∴ => ∴ e288b4 +Θ => Θ ce98 +   => âŸâ€Š e2819fe2808a +  =>   e28089 +∼ => ∼ e288bc +≃ => ≃ e28983 +≅ => ≅ e28985 +≈ => ≈ e28988 +𝕋 => ð•‹ f09d958b +⃛ => ⃛ e2839b +𝒯 => ð’¯ f09d92af +Ŧ => Ŧ c5a6 +Ú => Ú c39a +↟ => ↟ e2869f +⥉ => ⥉ e2a589 +Ў => ÐŽ d08e +Ŭ => Ŭ c5ac +Û => Û c39b +У => У d0a3 +Ű => Ű c5b0 +𝔘 => 𔘠f09d9498 +Ù => Ù c399 +Ū => Ū c5aa +_ => _ 5f +⏟ => ⟠e28f9f +⎵ => ⎵ e28eb5 +⏝ => â e28f9d +⋃ => ⋃ e28b83 +⊎ => ⊎ e28a8e +Ų => Ų c5b2 +𝕌 => 𕌠f09d958c +↑ => ↑ e28691 +⤒ => ⤒ e2a492 +⇅ => ⇅ e28785 +↕ => ↕ e28695 +⥮ => ⥮ e2a5ae +⊥ => ⊥ e28aa5 +↥ => ↥ e286a5 +⇑ => ⇑ e28791 +⇕ => ⇕ e28795 +↖ => ↖ e28696 +↗ => ↗ e28697 +ϒ => Ï’ cf92 +Υ => Î¥ cea5 +Ů => Å® c5ae +𝒰 => ð’° f09d92b0 +Ũ => Ũ c5a8 +Ü => Ü c39c +⊫ => ⊫ e28aab +⫫ => â«« e2abab +В => Ð’ d092 +⊩ => ⊩ e28aa9 +⫦ => ⫦ e2aba6 +⋁ => â‹ e28b81 +‖ => ‖ e28096 +‖ => ‖ e28096 +∣ => ∣ e288a3 +| => | 7c +❘ => ☠e29d98 +≀ => ≀ e28980 +  =>   e2808a +𝔙 => ð”™ f09d9499 +𝕍 => ð• f09d958d +𝒱 => ð’± f09d92b1 +⊪ => ⊪ e28aaa +Ŵ => Å´ c5b4 +⋀ => â‹€ e28b80 +𝔚 => 𔚠f09d949a +𝕎 => 𕎠f09d958e +𝒲 => ð’² f09d92b2 +𝔛 => ð”› f09d949b +Ξ => Ξ ce9e +𝕏 => ð• f09d958f +𝒳 => ð’³ f09d92b3 +Я => Я d0af +Ї => Ї d087 +Ю => Ю d0ae +Ý => à c39d +Ŷ => Ŷ c5b6 +Ы => Ы d0ab +𝔜 => 𔜠f09d949c +𝕐 => ð• f09d9590 +𝒴 => ð’´ f09d92b4 +Ÿ => Ÿ c5b8 +Ж => Ж d096 +Ź => Ź c5b9 +Ž => Ž c5bd +З => З d097 +Ż => Å» c5bb +​ => ​ e2808b +Ζ => Ζ ce96 +ℨ => ℨ e284a8 +ℤ => ℤ e284a4 +𝒵 => ð’µ f09d92b5 +á => á c3a1 +ă => ă c483 +∾ => ∾ e288be +∾̳ => ∾̳ e288beccb3 +∿ => ∿ e288bf +â => â c3a2 +´ => ´ c2b4 +а => а d0b0 +æ => æ c3a6 +⁡ => â¡ e281a1 +𝔞 => 𔞠f09d949e +à => à c3a0 +ℵ => ℵ e284b5 +ℵ => ℵ e284b5 +α => α ceb1 +ā => Ä c481 +⨿ => ⨿ e2a8bf +& => & 26 +∧ => ∧ e288a7 +⩕ => â©• e2a995 +⩜ => ⩜ e2a99c +⩘ => ⩘ e2a998 +⩚ => ⩚ e2a99a +∠ => ∠ e288a0 +⦤ => ⦤ e2a6a4 +∠ => ∠ e288a0 +∡ => ∡ e288a1 +⦨ => ⦨ e2a6a8 +⦩ => ⦩ e2a6a9 +⦪ => ⦪ e2a6aa +⦫ => ⦫ e2a6ab +⦬ => ⦬ e2a6ac +⦭ => ⦭ e2a6ad +⦮ => ⦮ e2a6ae +⦯ => ⦯ e2a6af +∟ => ∟ e2889f +⊾ => ⊾ e28abe +⦝ => ⦠e2a69d +∢ => ∢ e288a2 +Å => Ã… c385 +⍼ => â¼ e28dbc +ą => Ä… c485 +𝕒 => ð•’ f09d9592 +≈ => ≈ e28988 +⩰ => â©° e2a9b0 +⩯ => ⩯ e2a9af +≊ => ≊ e2898a +≋ => ≋ e2898b +' => ' 27 +≈ => ≈ e28988 +≊ => ≊ e2898a +å => Ã¥ c3a5 +𝒶 => ð’¶ f09d92b6 +* => * 2a +≈ => ≈ e28988 +≍ => ≠e2898d +ã => ã c3a3 +ä => ä c3a4 +∳ => ∳ e288b3 +⨑ => ⨑ e2a891 +⫭ => â«­ e2abad +≌ => ≌ e2898c +϶ => ϶ cfb6 +‵ => ‵ e280b5 +∽ => ∽ e288bd +⋍ => â‹ e28b8d +⊽ => ⊽ e28abd +⌅ => ⌅ e28c85 +⌅ => ⌅ e28c85 +⎵ => ⎵ e28eb5 +⎶ => ⎶ e28eb6 +≌ => ≌ e2898c +б => б d0b1 +„ => „ e2809e +∵ => ∵ e288b5 +∵ => ∵ e288b5 +⦰ => ⦰ e2a6b0 +϶ => ϶ cfb6 +ℬ => ℬ e284ac +β => β ceb2 +ℶ => â„¶ e284b6 +≬ => ≬ e289ac +𝔟 => 𔟠f09d949f +⋂ => â‹‚ e28b82 +◯ => â—¯ e297af +⋃ => ⋃ e28b83 +⨀ => ⨀ e2a880 +⨁ => ⨠e2a881 +⨂ => ⨂ e2a882 +⨆ => ⨆ e2a886 +★ => ★ e29885 +▽ => â–½ e296bd +△ => â–³ e296b3 +⨄ => ⨄ e2a884 +⋁ => â‹ e28b81 +⋀ => â‹€ e28b80 +⤍ => ⤠e2a48d +⧫ => â§« e2a7ab +▪ => â–ª e296aa +▴ => â–´ e296b4 +▾ => â–¾ e296be +◂ => â—‚ e29782 +▸ => â–¸ e296b8 +␣ => ⣠e290a3 +▒ => â–’ e29692 +░ => â–‘ e29691 +▓ => â–“ e29693 +█ => â–ˆ e29688 +=⃥ => =⃥ 3de283a5 +≡⃥ => ≡⃥ e289a1e283a5 +⌐ => ⌠e28c90 +𝕓 => ð•“ f09d9593 +⊥ => ⊥ e28aa5 +⊥ => ⊥ e28aa5 +⋈ => ⋈ e28b88 +╗ => â•— e29597 +╔ => â•” e29594 +╖ => â•– e29596 +╓ => â•“ e29593 +═ => â• e29590 +╦ => ╦ e295a6 +╩ => â•© e295a9 +╤ => ╤ e295a4 +╧ => â•§ e295a7 +╝ => â• e2959d +╚ => ╚ e2959a +╜ => ╜ e2959c +╙ => â•™ e29599 +║ => â•‘ e29591 +╬ => ╬ e295ac +╣ => â•£ e295a3 +╠ => â•  e295a0 +╫ => â•« e295ab +╢ => â•¢ e295a2 +╟ => ╟ e2959f +⧉ => ⧉ e2a789 +╕ => â•• e29595 +╒ => â•’ e29592 +┐ => â” e29490 +┌ => ┌ e2948c +─ => ─ e29480 +╥ => â•¥ e295a5 +╨ => ╨ e295a8 +┬ => ┬ e294ac +┴ => â”´ e294b4 +⊟ => ⊟ e28a9f +⊞ => ⊞ e28a9e +⊠ => ⊠ e28aa0 +╛ => â•› e2959b +╘ => ╘ e29598 +┘ => ┘ e29498 +└ => â”” e29494 +│ => │ e29482 +╪ => ╪ e295aa +╡ => â•¡ e295a1 +╞ => ╞ e2959e +┼ => ┼ e294bc +┤ => ┤ e294a4 +├ => ├ e2949c +‵ => ‵ e280b5 +˘ => ˘ cb98 +¦ => ¦ c2a6 +𝒷 => ð’· f09d92b7 +⁏ => â e2818f +∽ => ∽ e288bd +⋍ => â‹ e28b8d +\ => \ 5c +⧅ => â§… e2a785 +⟈ => ⟈ e29f88 +• => • e280a2 +• => • e280a2 +≎ => ≎ e2898e +⪮ => ⪮ e2aaae +≏ => ≠e2898f +≏ => ≠e2898f +ć => ć c487 +∩ => ∩ e288a9 +⩄ => â©„ e2a984 +⩉ => ⩉ e2a989 +⩋ => â©‹ e2a98b +⩇ => ⩇ e2a987 +⩀ => â©€ e2a980 +∩︀ => ∩︀ e288a9efb880 +⁁ => â e28181 +ˇ => ˇ cb87 +⩍ => â© e2a98d +č => Ä c48d +ç => ç c3a7 +ĉ => ĉ c489 +⩌ => ⩌ e2a98c +⩐ => â© e2a990 +ċ => Ä‹ c48b +¸ => ¸ c2b8 +⦲ => ⦲ e2a6b2 +¢ => ¢ c2a2 +· => · c2b7 +𝔠 => ð”  f09d94a0 +ч => ч d187 +✓ => ✓ e29c93 +✓ => ✓ e29c93 +χ => χ cf87 +○ => â—‹ e2978b +⧃ => ⧃ e2a783 +ˆ => ˆ cb86 +≗ => ≗ e28997 +↺ => ↺ e286ba +↻ => ↻ e286bb +® => ® c2ae +Ⓢ => Ⓢ e29388 +⊛ => ⊛ e28a9b +⊚ => ⊚ e28a9a +⊝ => ⊠e28a9d +≗ => ≗ e28997 +⨐ => ⨠e2a890 +⫯ => ⫯ e2abaf +⧂ => â§‚ e2a782 +♣ => ♣ e299a3 +♣ => ♣ e299a3 +: => : 3a +≔ => ≔ e28994 +≔ => ≔ e28994 +, => , 2c +@ => @ 40 +∁ => ∠e28881 +∘ => ∘ e28898 +∁ => ∠e28881 +ℂ => â„‚ e28482 +≅ => ≅ e28985 +⩭ => â©­ e2a9ad +∮ => ∮ e288ae +𝕔 => ð•” f09d9594 +∐ => ∠e28890 +© => © c2a9 +℗ => â„— e28497 +↵ => ↵ e286b5 +✗ => ✗ e29c97 +𝒸 => ð’¸ f09d92b8 +⫏ => â« e2ab8f +⫑ => â«‘ e2ab91 +⫐ => â« e2ab90 +⫒ => â«’ e2ab92 +⋯ => ⋯ e28baf +⤸ => ⤸ e2a4b8 +⤵ => ⤵ e2a4b5 +⋞ => ⋞ e28b9e +⋟ => ⋟ e28b9f +↶ => ↶ e286b6 +⤽ => ⤽ e2a4bd +∪ => ∪ e288aa +⩈ => ⩈ e2a988 +⩆ => ⩆ e2a986 +⩊ => ⩊ e2a98a +⊍ => ⊠e28a8d +⩅ => â©… e2a985 +∪︀ => ∪︀ e288aaefb880 +↷ => ↷ e286b7 +⤼ => ⤼ e2a4bc +⋞ => ⋞ e28b9e +⋟ => ⋟ e28b9f +⋎ => ⋎ e28b8e +⋏ => â‹ e28b8f +¤ => ¤ c2a4 +↶ => ↶ e286b6 +↷ => ↷ e286b7 +⋎ => ⋎ e28b8e +⋏ => â‹ e28b8f +∲ => ∲ e288b2 +∱ => ∱ e288b1 +⌭ => ⌭ e28cad +⇓ => ⇓ e28793 +⥥ => ⥥ e2a5a5 +† => † e280a0 +ℸ => ℸ e284b8 +↓ => ↓ e28693 +‐ => †e28090 +⊣ => ⊣ e28aa3 +⤏ => ⤠e2a48f +˝ => Ë cb9d +ď => Ä c48f +д => д d0b4 +ⅆ => â…† e28586 +‡ => ‡ e280a1 +⇊ => ⇊ e2878a +⩷ => â©· e2a9b7 +° => ° c2b0 +δ => δ ceb4 +⦱ => ⦱ e2a6b1 +⥿ => ⥿ e2a5bf +𝔡 => 𔡠f09d94a1 +⇃ => ⇃ e28783 +⇂ => ⇂ e28782 +⋄ => â‹„ e28b84 +⋄ => â‹„ e28b84 +♦ => ♦ e299a6 +♦ => ♦ e299a6 +¨ => ¨ c2a8 +ϝ => Ï cf9d +⋲ => ⋲ e28bb2 +÷ => ÷ c3b7 +÷ => ÷ c3b7 +⋇ => ⋇ e28b87 +⋇ => ⋇ e28b87 +ђ => Ñ’ d192 +⌞ => ⌞ e28c9e +⌍ => ⌠e28c8d +$ => $ 24 +𝕕 => ð•• f09d9595 +˙ => Ë™ cb99 +≐ => ≠e28990 +≑ => ≑ e28991 +∸ => ∸ e288b8 +∔ => ∔ e28894 +⊡ => ⊡ e28aa1 +⌆ => ⌆ e28c86 +↓ => ↓ e28693 +⇊ => ⇊ e2878a +⇃ => ⇃ e28783 +⇂ => ⇂ e28782 +⤐ => ⤠e2a490 +⌟ => ⌟ e28c9f +⌌ => ⌌ e28c8c +𝒹 => ð’¹ f09d92b9 +ѕ => Ñ• d195 +⧶ => â§¶ e2a7b6 +đ => Ä‘ c491 +⋱ => ⋱ e28bb1 +▿ => â–¿ e296bf +▾ => â–¾ e296be +⇵ => ⇵ e287b5 +⥯ => ⥯ e2a5af +⦦ => ⦦ e2a6a6 +џ => ÑŸ d19f +⟿ => ⟿ e29fbf +⩷ => â©· e2a9b7 +≑ => ≑ e28991 +é => é c3a9 +⩮ => â©® e2a9ae +ě => Ä› c49b +≖ => ≖ e28996 +ê => ê c3aa +≕ => ≕ e28995 +э => Ñ d18d +ė => Ä— c497 +ⅇ => â…‡ e28587 +≒ => ≒ e28992 +𝔢 => 𔢠f09d94a2 +⪚ => ⪚ e2aa9a +è => è c3a8 +⪖ => ⪖ e2aa96 +⪘ => ⪘ e2aa98 +⪙ => ⪙ e2aa99 +⏧ => â§ e28fa7 +ℓ => â„“ e28493 +⪕ => ⪕ e2aa95 +⪗ => ⪗ e2aa97 +ē => Ä“ c493 +∅ => ∅ e28885 +∅ => ∅ e28885 +∅ => ∅ e28885 +  =>   e28083 +  =>   e28084 +  =>   e28085 +ŋ => Å‹ c58b +  =>   e28082 +ę => Ä™ c499 +𝕖 => ð•– f09d9596 +⋕ => â‹• e28b95 +⧣ => â§£ e2a7a3 +⩱ => ⩱ e2a9b1 +ε => ε ceb5 +ε => ε ceb5 +ϵ => ϵ cfb5 +≖ => ≖ e28996 +≕ => ≕ e28995 +≂ => ≂ e28982 +⪖ => ⪖ e2aa96 +⪕ => ⪕ e2aa95 += => = 3d +≟ => ≟ e2899f +≡ => ≡ e289a1 +⩸ => ⩸ e2a9b8 +⧥ => â§¥ e2a7a5 +≓ => ≓ e28993 +⥱ => ⥱ e2a5b1 +ℯ => ℯ e284af +≐ => ≠e28990 +≂ => ≂ e28982 +η => η ceb7 +ð => ð c3b0 +ë => ë c3ab +€ => € e282ac +! => ! 21 +∃ => ∃ e28883 +ℰ => â„° e284b0 +ⅇ => â…‡ e28587 +≒ => ≒ e28992 +ф => Ñ„ d184 +♀ => ♀ e29980 +ffi => ffi efac83 +ff => ff efac80 +ffl => ffl efac84 +𝔣 => 𔣠f09d94a3 +fi => ï¬ efac81 +fj => fj 666a +♭ => â™­ e299ad +fl => fl efac82 +▱ => â–± e296b1 +ƒ => Æ’ c692 +𝕗 => ð•— f09d9597 +∀ => ∀ e28880 +⋔ => â‹” e28b94 +⫙ => â«™ e2ab99 +⨍ => ⨠e2a88d +½ => ½ c2bd +⅓ => â…“ e28593 +¼ => ¼ c2bc +⅕ => â…• e28595 +⅙ => â…™ e28599 +⅛ => â…› e2859b +⅔ => â…” e28594 +⅖ => â…– e28596 +¾ => ¾ c2be +⅗ => â…— e28597 +⅜ => â…œ e2859c +⅘ => â…˜ e28598 +⅚ => â…š e2859a +⅝ => â… e2859d +⅞ => â…ž e2859e +⁄ => â„ e28184 +⌢ => ⌢ e28ca2 +𝒻 => ð’» f09d92bb +≧ => ≧ e289a7 +⪌ => ⪌ e2aa8c +ǵ => ǵ c7b5 +γ => γ ceb3 +ϝ => Ï cf9d +⪆ => ⪆ e2aa86 +ğ => ÄŸ c49f +ĝ => Ä c49d +г => г d0b3 +ġ => Ä¡ c4a1 +≥ => ≥ e289a5 +⋛ => â‹› e28b9b +≥ => ≥ e289a5 +≧ => ≧ e289a7 +⩾ => ⩾ e2a9be +⩾ => ⩾ e2a9be +⪩ => ⪩ e2aaa9 +⪀ => ⪀ e2aa80 +⪂ => ⪂ e2aa82 +⪄ => ⪄ e2aa84 +⋛︀ => ⋛︀ e28b9befb880 +⪔ => ⪔ e2aa94 +𝔤 => 𔤠f09d94a4 +≫ => ≫ e289ab +⋙ => â‹™ e28b99 +ℷ => â„· e284b7 +ѓ => Ñ“ d193 +≷ => ≷ e289b7 +⪒ => ⪒ e2aa92 +⪥ => ⪥ e2aaa5 +⪤ => ⪤ e2aaa4 +≩ => ≩ e289a9 +⪊ => ⪊ e2aa8a +⪊ => ⪊ e2aa8a +⪈ => ⪈ e2aa88 +⪈ => ⪈ e2aa88 +≩ => ≩ e289a9 +⋧ => â‹§ e28ba7 +𝕘 => 𕘠f09d9598 +` => ` 60 +ℊ => ℊ e2848a +≳ => ≳ e289b3 +⪎ => ⪎ e2aa8e +⪐ => ⪠e2aa90 +> => > 3e +⪧ => ⪧ e2aaa7 +⩺ => ⩺ e2a9ba +⋗ => â‹— e28b97 +⦕ => ⦕ e2a695 +⩼ => ⩼ e2a9bc +⪆ => ⪆ e2aa86 +⥸ => ⥸ e2a5b8 +⋗ => â‹— e28b97 +⋛ => â‹› e28b9b +⪌ => ⪌ e2aa8c +≷ => ≷ e289b7 +≳ => ≳ e289b3 +≩︀ => ≩︀ e289a9efb880 +≩︀ => ≩︀ e289a9efb880 +⇔ => ⇔ e28794 +  =>   e2808a +½ => ½ c2bd +ℋ => â„‹ e2848b +ъ => ÑŠ d18a +↔ => ↔ e28694 +⥈ => ⥈ e2a588 +↭ => ↭ e286ad +ℏ => â„ e2848f +ĥ => Ä¥ c4a5 +♥ => ♥ e299a5 +♥ => ♥ e299a5 +… => … e280a6 +⊹ => ⊹ e28ab9 +𝔥 => 𔥠f09d94a5 +⤥ => ⤥ e2a4a5 +⤦ => ⤦ e2a4a6 +⇿ => ⇿ e287bf +∻ => ∻ e288bb +↩ => ↩ e286a9 +↪ => ↪ e286aa +𝕙 => ð•™ f09d9599 +― => ― e28095 +𝒽 => ð’½ f09d92bd +ℏ => â„ e2848f +ħ => ħ c4a7 +⁃ => ⃠e28183 +‐ => †e28090 +í => í c3ad +⁣ => ⣠e281a3 +î => î c3ae +и => и d0b8 +е => е d0b5 +¡ => ¡ c2a1 +⇔ => ⇔ e28794 +𝔦 => 𔦠f09d94a6 +ì => ì c3ac +ⅈ => â…ˆ e28588 +⨌ => ⨌ e2a88c +∭ => ∭ e288ad +⧜ => â§œ e2a79c +℩ => â„© e284a9 +ij => ij c4b3 +ī => Ä« c4ab +ℑ => â„‘ e28491 +ℐ => â„ e28490 +ℑ => â„‘ e28491 +ı => ı c4b1 +⊷ => ⊷ e28ab7 +Ƶ => Ƶ c6b5 +∈ => ∈ e28888 +℅ => â„… e28485 +∞ => ∞ e2889e +⧝ => â§ e2a79d +ı => ı c4b1 +∫ => ∫ e288ab +⊺ => ⊺ e28aba +ℤ => ℤ e284a4 +⊺ => ⊺ e28aba +⨗ => ⨗ e2a897 +⨼ => ⨼ e2a8bc +ё => Ñ‘ d191 +į => į c4af +𝕚 => 𕚠f09d959a +ι => ι ceb9 +⨼ => ⨼ e2a8bc +¿ => ¿ c2bf +𝒾 => ð’¾ f09d92be +∈ => ∈ e28888 +⋹ => ⋹ e28bb9 +⋵ => ⋵ e28bb5 +⋴ => â‹´ e28bb4 +⋳ => ⋳ e28bb3 +∈ => ∈ e28888 +⁢ => ⢠e281a2 +ĩ => Ä© c4a9 +і => Ñ– d196 +ï => ï c3af +ĵ => ĵ c4b5 +й => й d0b9 +𝔧 => ð”§ f09d94a7 +ȷ => È· c8b7 +𝕛 => ð•› f09d959b +𝒿 => ð’¿ f09d92bf +ј => ј d198 +є => Ñ” d194 +κ => κ ceba +ϰ => ϰ cfb0 +ķ => Ä· c4b7 +к => к d0ba +𝔨 => 𔨠f09d94a8 +ĸ => ĸ c4b8 +х => Ñ… d185 +ќ => Ñœ d19c +𝕜 => 𕜠f09d959c +𝓀 => ð“€ f09d9380 +⇚ => ⇚ e2879a +⇐ => ⇠e28790 +⤛ => ⤛ e2a49b +⤎ => ⤎ e2a48e +≦ => ≦ e289a6 +⪋ => ⪋ e2aa8b +⥢ => ⥢ e2a5a2 +ĺ => ĺ c4ba +⦴ => ⦴ e2a6b4 +ℒ => â„’ e28492 +λ => λ cebb +⟨ => ⟨ e29fa8 +⦑ => ⦑ e2a691 +⟨ => ⟨ e29fa8 +⪅ => ⪅ e2aa85 +« => « c2ab +← => ↠e28690 +⇤ => ⇤ e287a4 +⤟ => ⤟ e2a49f +⤝ => ⤠e2a49d +↩ => ↩ e286a9 +↫ => ↫ e286ab +⤹ => ⤹ e2a4b9 +⥳ => ⥳ e2a5b3 +↢ => ↢ e286a2 +⪫ => ⪫ e2aaab +⤙ => ⤙ e2a499 +⪭ => ⪭ e2aaad +⪭︀ => ⪭︀ e2aaadefb880 +⤌ => ⤌ e2a48c +❲ => â² e29db2 +{ => { 7b +[ => [ 5b +⦋ => ⦋ e2a68b +⦏ => ⦠e2a68f +⦍ => ⦠e2a68d +ľ => ľ c4be +ļ => ļ c4bc +⌈ => ⌈ e28c88 +{ => { 7b +л => л d0bb +⤶ => ⤶ e2a4b6 +“ => “ e2809c +„ => „ e2809e +⥧ => ⥧ e2a5a7 +⥋ => ⥋ e2a58b +↲ => ↲ e286b2 +≤ => ≤ e289a4 +← => ↠e28690 +↢ => ↢ e286a2 +↽ => ↽ e286bd +↼ => ↼ e286bc +⇇ => ⇇ e28787 +↔ => ↔ e28694 +⇆ => ⇆ e28786 +⇋ => ⇋ e2878b +↭ => ↭ e286ad +⋋ => â‹‹ e28b8b +⋚ => ⋚ e28b9a +≤ => ≤ e289a4 +≦ => ≦ e289a6 +⩽ => ⩽ e2a9bd +⩽ => ⩽ e2a9bd +⪨ => ⪨ e2aaa8 +⩿ => â©¿ e2a9bf +⪁ => ⪠e2aa81 +⪃ => ⪃ e2aa83 +⋚︀ => ⋚︀ e28b9aefb880 +⪓ => ⪓ e2aa93 +⪅ => ⪅ e2aa85 +⋖ => â‹– e28b96 +⋚ => ⋚ e28b9a +⪋ => ⪋ e2aa8b +≶ => ≶ e289b6 +≲ => ≲ e289b2 +⥼ => ⥼ e2a5bc +⌊ => ⌊ e28c8a +𝔩 => 𔩠f09d94a9 +≶ => ≶ e289b6 +⪑ => ⪑ e2aa91 +↽ => ↽ e286bd +↼ => ↼ e286bc +⥪ => ⥪ e2a5aa +▄ => â–„ e29684 +љ => Ñ™ d199 +≪ => ≪ e289aa +⇇ => ⇇ e28787 +⌞ => ⌞ e28c9e +⥫ => ⥫ e2a5ab +◺ => â—º e297ba +ŀ => Å€ c580 +⎰ => ⎰ e28eb0 +⎰ => ⎰ e28eb0 +≨ => ≨ e289a8 +⪉ => ⪉ e2aa89 +⪉ => ⪉ e2aa89 +⪇ => ⪇ e2aa87 +⪇ => ⪇ e2aa87 +≨ => ≨ e289a8 +⋦ => ⋦ e28ba6 +⟬ => ⟬ e29fac +⇽ => ⇽ e287bd +⟦ => ⟦ e29fa6 +⟵ => ⟵ e29fb5 +⟷ => ⟷ e29fb7 +⟼ => ⟼ e29fbc +⟶ => ⟶ e29fb6 +↫ => ↫ e286ab +↬ => ↬ e286ac +⦅ => ⦅ e2a685 +𝕝 => ð• f09d959d +⨭ => ⨭ e2a8ad +⨴ => ⨴ e2a8b4 +∗ => ∗ e28897 +_ => _ 5f +◊ => â—Š e2978a +◊ => â—Š e2978a +⧫ => â§« e2a7ab +( => ( 28 +⦓ => ⦓ e2a693 +⇆ => ⇆ e28786 +⌟ => ⌟ e28c9f +⇋ => ⇋ e2878b +⥭ => ⥭ e2a5ad +‎ => ‎ e2808e +⊿ => ⊿ e28abf +‹ => ‹ e280b9 +𝓁 => ð“ f09d9381 +↰ => ↰ e286b0 +≲ => ≲ e289b2 +⪍ => ⪠e2aa8d +⪏ => ⪠e2aa8f +[ => [ 5b +‘ => ‘ e28098 +‚ => ‚ e2809a +ł => Å‚ c582 +< => < 3c +⪦ => ⪦ e2aaa6 +⩹ => ⩹ e2a9b9 +⋖ => â‹– e28b96 +⋋ => â‹‹ e28b8b +⋉ => ⋉ e28b89 +⥶ => ⥶ e2a5b6 +⩻ => â©» e2a9bb +⦖ => ⦖ e2a696 +◃ => â—ƒ e29783 +⊴ => ⊴ e28ab4 +◂ => â—‚ e29782 +⥊ => ⥊ e2a58a +⥦ => ⥦ e2a5a6 +≨︀ => ≨︀ e289a8efb880 +≨︀ => ≨︀ e289a8efb880 +∺ => ∺ e288ba +¯ => ¯ c2af +♂ => ♂ e29982 +✠ => ✠ e29ca0 +✠ => ✠ e29ca0 +↦ => ↦ e286a6 +↦ => ↦ e286a6 +↧ => ↧ e286a7 +↤ => ↤ e286a4 +↥ => ↥ e286a5 +▮ => â–® e296ae +⨩ => ⨩ e2a8a9 +м => м d0bc +— => — e28094 +∡ => ∡ e288a1 +𝔪 => 𔪠f09d94aa +℧ => â„§ e284a7 +µ => µ c2b5 +∣ => ∣ e288a3 +* => * 2a +⫰ => â«° e2abb0 +· => · c2b7 +− => − e28892 +⊟ => ⊟ e28a9f +∸ => ∸ e288b8 +⨪ => ⨪ e2a8aa +⫛ => â«› e2ab9b +… => … e280a6 +∓ => ∓ e28893 +⊧ => ⊧ e28aa7 +𝕞 => 𕞠f09d959e +∓ => ∓ e28893 +𝓂 => ð“‚ f09d9382 +∾ => ∾ e288be +μ => μ cebc +⊸ => ⊸ e28ab8 +⊸ => ⊸ e28ab8 +⋙̸ => ⋙̸ e28b99ccb8 +≫⃒ => ≫⃒ e289abe28392 +≫̸ => ≫̸ e289abccb8 +⇍ => ⇠e2878d +⇎ => ⇎ e2878e +⋘̸ => ⋘̸ e28b98ccb8 +≪⃒ => ≪⃒ e289aae28392 +≪̸ => ≪̸ e289aaccb8 +⇏ => ⇠e2878f +⊯ => ⊯ e28aaf +⊮ => ⊮ e28aae +∇ => ∇ e28887 +ń => Å„ c584 +∠⃒ => ∠⃒ e288a0e28392 +≉ => ≉ e28989 +⩰̸ => ⩰̸ e2a9b0ccb8 +≋̸ => ≋̸ e2898bccb8 +ʼn => ʼn c589 +≉ => ≉ e28989 +♮ => â™® e299ae +♮ => â™® e299ae +ℕ => â„• e28495 +  =>   c2a0 +≎̸ => ≎̸ e2898eccb8 +≏̸ => â‰Ì¸ e2898fccb8 +⩃ => ⩃ e2a983 +ň => ň c588 +ņ => ņ c586 +≇ => ≇ e28987 +⩭̸ => ⩭̸ e2a9adccb8 +⩂ => â©‚ e2a982 +н => н d0bd +– => – e28093 +≠ => ≠ e289a0 +⇗ => ⇗ e28797 +⤤ => ⤤ e2a4a4 +↗ => ↗ e28697 +↗ => ↗ e28697 +≐̸ => â‰Ì¸ e28990ccb8 +≢ => ≢ e289a2 +⤨ => ⤨ e2a4a8 +≂̸ => ≂̸ e28982ccb8 +∄ => ∄ e28884 +∄ => ∄ e28884 +𝔫 => 𔫠f09d94ab +≧̸ => ≧̸ e289a7ccb8 +≱ => ≱ e289b1 +≱ => ≱ e289b1 +≧̸ => ≧̸ e289a7ccb8 +⩾̸ => ⩾̸ e2a9beccb8 +⩾̸ => ⩾̸ e2a9beccb8 +≵ => ≵ e289b5 +≯ => ≯ e289af +≯ => ≯ e289af +⇎ => ⇎ e2878e +↮ => ↮ e286ae +⫲ => ⫲ e2abb2 +∋ => ∋ e2888b +⋼ => ⋼ e28bbc +⋺ => ⋺ e28bba +∋ => ∋ e2888b +њ => Ñš d19a +⇍ => ⇠e2878d +≦̸ => ≦̸ e289a6ccb8 +↚ => ↚ e2869a +‥ => ‥ e280a5 +≰ => ≰ e289b0 +↚ => ↚ e2869a +↮ => ↮ e286ae +≰ => ≰ e289b0 +≦̸ => ≦̸ e289a6ccb8 +⩽̸ => ⩽̸ e2a9bdccb8 +⩽̸ => ⩽̸ e2a9bdccb8 +≮ => ≮ e289ae +≴ => ≴ e289b4 +≮ => ≮ e289ae +⋪ => ⋪ e28baa +⋬ => ⋬ e28bac +∤ => ∤ e288a4 +𝕟 => 𕟠f09d959f +¬ => ¬ c2ac +∉ => ∉ e28889 +⋹̸ => ⋹̸ e28bb9ccb8 +⋵̸ => ⋵̸ e28bb5ccb8 +∉ => ∉ e28889 +⋷ => â‹· e28bb7 +⋶ => â‹¶ e28bb6 +∌ => ∌ e2888c +∌ => ∌ e2888c +⋾ => ⋾ e28bbe +⋽ => ⋽ e28bbd +∦ => ∦ e288a6 +∦ => ∦ e288a6 +⫽⃥ => ⫽⃥ e2abbde283a5 +∂̸ => ∂̸ e28882ccb8 +⨔ => ⨔ e2a894 +⊀ => ⊀ e28a80 +⋠ => â‹  e28ba0 +⪯̸ => ⪯̸ e2aaafccb8 +⊀ => ⊀ e28a80 +⪯̸ => ⪯̸ e2aaafccb8 +⇏ => ⇠e2878f +↛ => ↛ e2869b +⤳̸ => ⤳̸ e2a4b3ccb8 +↝̸ => â†Ì¸ e2869dccb8 +↛ => ↛ e2869b +⋫ => â‹« e28bab +⋭ => â‹­ e28bad +⊁ => ⊠e28a81 +⋡ => â‹¡ e28ba1 +⪰̸ => ⪰̸ e2aab0ccb8 +𝓃 => 𓃠f09d9383 +∤ => ∤ e288a4 +∦ => ∦ e288a6 +≁ => ≠e28981 +≄ => ≄ e28984 +≄ => ≄ e28984 +∤ => ∤ e288a4 +∦ => ∦ e288a6 +⋢ => â‹¢ e28ba2 +⋣ => â‹£ e28ba3 +⊄ => ⊄ e28a84 +⫅̸ => ⫅̸ e2ab85ccb8 +⊈ => ⊈ e28a88 +⊂⃒ => ⊂⃒ e28a82e28392 +⊈ => ⊈ e28a88 +⫅̸ => ⫅̸ e2ab85ccb8 +⊁ => ⊠e28a81 +⪰̸ => ⪰̸ e2aab0ccb8 +⊅ => ⊅ e28a85 +⫆̸ => ⫆̸ e2ab86ccb8 +⊉ => ⊉ e28a89 +⊃⃒ => ⊃⃒ e28a83e28392 +⊉ => ⊉ e28a89 +⫆̸ => ⫆̸ e2ab86ccb8 +≹ => ≹ e289b9 +ñ => ñ c3b1 +≸ => ≸ e289b8 +⋪ => ⋪ e28baa +⋬ => ⋬ e28bac +⋫ => â‹« e28bab +⋭ => â‹­ e28bad +ν => ν cebd +# => # 23 +№ => â„– e28496 +  =>   e28087 +⊭ => ⊭ e28aad +⤄ => ⤄ e2a484 +≍⃒ => â‰âƒ’ e2898de28392 +⊬ => ⊬ e28aac +≥⃒ => ≥⃒ e289a5e28392 +>⃒ => >⃒ 3ee28392 +⧞ => â§ž e2a79e +⤂ => ⤂ e2a482 +≤⃒ => ≤⃒ e289a4e28392 +<⃒ => <⃒ 3ce28392 +⊴⃒ => ⊴⃒ e28ab4e28392 +⤃ => ⤃ e2a483 +⊵⃒ => ⊵⃒ e28ab5e28392 +∼⃒ => ∼⃒ e288bce28392 +⇖ => ⇖ e28796 +⤣ => ⤣ e2a4a3 +↖ => ↖ e28696 +↖ => ↖ e28696 +⤧ => ⤧ e2a4a7 +Ⓢ => Ⓢ e29388 +ó => ó c3b3 +⊛ => ⊛ e28a9b +⊚ => ⊚ e28a9a +ô => ô c3b4 +о => о d0be +⊝ => ⊠e28a9d +ő => Å‘ c591 +⨸ => ⨸ e2a8b8 +⊙ => ⊙ e28a99 +⦼ => ⦼ e2a6bc +œ => Å“ c593 +⦿ => ⦿ e2a6bf +𝔬 => 𔬠f09d94ac +˛ => Ë› cb9b +ò => ò c3b2 +⧁ => â§ e2a781 +⦵ => ⦵ e2a6b5 +Ω => Ω cea9 +∮ => ∮ e288ae +↺ => ↺ e286ba +⦾ => ⦾ e2a6be +⦻ => ⦻ e2a6bb +‾ => ‾ e280be +⧀ => â§€ e2a780 +ō => Å c58d +ω => ω cf89 +ο => ο cebf +⦶ => ⦶ e2a6b6 +⊖ => ⊖ e28a96 +𝕠 => ð•  f09d95a0 +⦷ => ⦷ e2a6b7 +⦹ => ⦹ e2a6b9 +⊕ => ⊕ e28a95 +∨ => ∨ e288a8 +↻ => ↻ e286bb +⩝ => â© e2a99d +ℴ => â„´ e284b4 +ℴ => â„´ e284b4 +ª => ª c2aa +º => º c2ba +⊶ => ⊶ e28ab6 +⩖ => â©– e2a996 +⩗ => â©— e2a997 +⩛ => â©› e2a99b +ℴ => â„´ e284b4 +ø => ø c3b8 +⊘ => ⊘ e28a98 +õ => õ c3b5 +⊗ => ⊗ e28a97 +⨶ => ⨶ e2a8b6 +ö => ö c3b6 +⌽ => ⌽ e28cbd +∥ => ∥ e288a5 +¶ => ¶ c2b6 +∥ => ∥ e288a5 +⫳ => ⫳ e2abb3 +⫽ => ⫽ e2abbd +∂ => ∂ e28882 +п => п d0bf +% => % 25 +. => . 2e +‰ => ‰ e280b0 +⊥ => ⊥ e28aa5 +‱ => ‱ e280b1 +𝔭 => ð”­ f09d94ad +φ => φ cf86 +ϕ => Ï• cf95 +ℳ => ℳ e284b3 +☎ => ☎ e2988e +π => Ï€ cf80 +⋔ => â‹” e28b94 +ϖ => Ï– cf96 +ℏ => â„ e2848f +ℎ => ℎ e2848e +ℏ => â„ e2848f ++ => + 2b +⨣ => ⨣ e2a8a3 +⊞ => ⊞ e28a9e +⨢ => ⨢ e2a8a2 +∔ => ∔ e28894 +⨥ => ⨥ e2a8a5 +⩲ => ⩲ e2a9b2 +± => ± c2b1 +⨦ => ⨦ e2a8a6 +⨧ => ⨧ e2a8a7 +± => ± c2b1 +⨕ => ⨕ e2a895 +𝕡 => ð•¡ f09d95a1 +£ => £ c2a3 +≺ => ≺ e289ba +⪳ => ⪳ e2aab3 +⪷ => ⪷ e2aab7 +≼ => ≼ e289bc +⪯ => ⪯ e2aaaf +≺ => ≺ e289ba +⪷ => ⪷ e2aab7 +≼ => ≼ e289bc +⪯ => ⪯ e2aaaf +⪹ => ⪹ e2aab9 +⪵ => ⪵ e2aab5 +⋨ => ⋨ e28ba8 +≾ => ≾ e289be +′ => ′ e280b2 +ℙ => â„™ e28499 +⪵ => ⪵ e2aab5 +⪹ => ⪹ e2aab9 +⋨ => ⋨ e28ba8 +∏ => ∠e2888f +⌮ => ⌮ e28cae +⌒ => ⌒ e28c92 +⌓ => ⌓ e28c93 +∝ => ∠e2889d +∝ => ∠e2889d +≾ => ≾ e289be +⊰ => ⊰ e28ab0 +𝓅 => ð“… f09d9385 +ψ => ψ cf88 +  =>   e28088 +𝔮 => ð”® f09d94ae +⨌ => ⨌ e2a88c +𝕢 => ð•¢ f09d95a2 +⁗ => â— e28197 +𝓆 => 𓆠f09d9386 +ℍ => â„ e2848d +⨖ => ⨖ e2a896 +? => ? 3f +≟ => ≟ e2899f +" => " 22 +⇛ => ⇛ e2879b +⇒ => ⇒ e28792 +⤜ => ⤜ e2a49c +⤏ => ⤠e2a48f +⥤ => ⥤ e2a5a4 +∽̱ => ∽̱ e288bdccb1 +ŕ => Å• c595 +√ => √ e2889a +⦳ => ⦳ e2a6b3 +⟩ => ⟩ e29fa9 +⦒ => ⦒ e2a692 +⦥ => ⦥ e2a6a5 +⟩ => ⟩ e29fa9 +» => » c2bb +→ => → e28692 +⥵ => ⥵ e2a5b5 +⇥ => ⇥ e287a5 +⤠ => ⤠ e2a4a0 +⤳ => ⤳ e2a4b3 +⤞ => ⤞ e2a49e +↪ => ↪ e286aa +↬ => ↬ e286ac +⥅ => ⥅ e2a585 +⥴ => ⥴ e2a5b4 +↣ => ↣ e286a3 +↝ => ↠e2869d +⤚ => ⤚ e2a49a +∶ => ∶ e288b6 +ℚ => ℚ e2849a +⤍ => ⤠e2a48d +❳ => â³ e29db3 +} => } 7d +] => ] 5d +⦌ => ⦌ e2a68c +⦎ => ⦎ e2a68e +⦐ => ⦠e2a690 +ř => Å™ c599 +ŗ => Å— c597 +⌉ => ⌉ e28c89 +} => } 7d +р => Ñ€ d180 +⤷ => ⤷ e2a4b7 +⥩ => ⥩ e2a5a9 +” => †e2809d +” => †e2809d +↳ => ↳ e286b3 +ℜ => ℜ e2849c +ℛ => â„› e2849b +ℜ => ℜ e2849c +ℝ => â„ e2849d +▭ => â–­ e296ad +® => ® c2ae +⥽ => ⥽ e2a5bd +⌋ => ⌋ e28c8b +𝔯 => 𔯠f09d94af +⇁ => ⇠e28781 +⇀ => ⇀ e28780 +⥬ => ⥬ e2a5ac +ρ => Ï cf81 +ϱ => ϱ cfb1 +→ => → e28692 +↣ => ↣ e286a3 +⇁ => ⇠e28781 +⇀ => ⇀ e28780 +⇄ => ⇄ e28784 +⇌ => ⇌ e2878c +⇉ => ⇉ e28789 +↝ => ↠e2869d +⋌ => ⋌ e28b8c +˚ => Ëš cb9a +≓ => ≓ e28993 +⇄ => ⇄ e28784 +⇌ => ⇌ e2878c +‏ => †e2808f +⎱ => ⎱ e28eb1 +⎱ => ⎱ e28eb1 +⫮ => â«® e2abae +⟭ => ⟭ e29fad +⇾ => ⇾ e287be +⟧ => ⟧ e29fa7 +⦆ => ⦆ e2a686 +𝕣 => ð•£ f09d95a3 +⨮ => ⨮ e2a8ae +⨵ => ⨵ e2a8b5 +) => ) 29 +⦔ => ⦔ e2a694 +⨒ => ⨒ e2a892 +⇉ => ⇉ e28789 +› => › e280ba +𝓇 => 𓇠f09d9387 +↱ => ↱ e286b1 +] => ] 5d +’ => ’ e28099 +’ => ’ e28099 +⋌ => ⋌ e28b8c +⋊ => ⋊ e28b8a +▹ => â–¹ e296b9 +⊵ => ⊵ e28ab5 +▸ => â–¸ e296b8 +⧎ => â§Ž e2a78e +⥨ => ⥨ e2a5a8 +℞ => ℞ e2849e +ś => Å› c59b +‚ => ‚ e2809a +≻ => ≻ e289bb +⪴ => ⪴ e2aab4 +⪸ => ⪸ e2aab8 +š => Å¡ c5a1 +≽ => ≽ e289bd +⪰ => ⪰ e2aab0 +ş => ÅŸ c59f +ŝ => Å c59d +⪶ => ⪶ e2aab6 +⪺ => ⪺ e2aaba +⋩ => â‹© e28ba9 +⨓ => ⨓ e2a893 +≿ => ≿ e289bf +с => Ñ d181 +⋅ => â‹… e28b85 +⊡ => ⊡ e28aa1 +⩦ => ⩦ e2a9a6 +⇘ => ⇘ e28798 +⤥ => ⤥ e2a4a5 +↘ => ↘ e28698 +↘ => ↘ e28698 +§ => § c2a7 +; => ; 3b +⤩ => ⤩ e2a4a9 +∖ => ∖ e28896 +∖ => ∖ e28896 +✶ => ✶ e29cb6 +𝔰 => ð”° f09d94b0 +⌢ => ⌢ e28ca2 +♯ => ♯ e299af +щ => щ d189 +ш => ш d188 +∣ => ∣ e288a3 +∥ => ∥ e288a5 +­ => ­ c2ad +σ => σ cf83 +ς => Ï‚ cf82 +ς => Ï‚ cf82 +∼ => ∼ e288bc +⩪ => ⩪ e2a9aa +≃ => ≃ e28983 +≃ => ≃ e28983 +⪞ => ⪞ e2aa9e +⪠ => ⪠ e2aaa0 +⪝ => ⪠e2aa9d +⪟ => ⪟ e2aa9f +≆ => ≆ e28986 +⨤ => ⨤ e2a8a4 +⥲ => ⥲ e2a5b2 +← => ↠e28690 +∖ => ∖ e28896 +⨳ => ⨳ e2a8b3 +⧤ => ⧤ e2a7a4 +∣ => ∣ e288a3 +⌣ => ⌣ e28ca3 +⪪ => ⪪ e2aaaa +⪬ => ⪬ e2aaac +⪬︀ => ⪬︀ e2aaacefb880 +ь => ÑŒ d18c +/ => / 2f +⧄ => â§„ e2a784 +⌿ => ⌿ e28cbf +𝕤 => 𕤠f09d95a4 +♠ => â™  e299a0 +♠ => â™  e299a0 +∥ => ∥ e288a5 +⊓ => ⊓ e28a93 +⊓︀ => ⊓︀ e28a93efb880 +⊔ => ⊔ e28a94 +⊔︀ => ⊔︀ e28a94efb880 +⊏ => ⊠e28a8f +⊑ => ⊑ e28a91 +⊏ => ⊠e28a8f +⊑ => ⊑ e28a91 +⊐ => ⊠e28a90 +⊒ => ⊒ e28a92 +⊐ => ⊠e28a90 +⊒ => ⊒ e28a92 +□ => â–¡ e296a1 +□ => â–¡ e296a1 +▪ => â–ª e296aa +▪ => â–ª e296aa +→ => → e28692 +𝓈 => 𓈠f09d9388 +∖ => ∖ e28896 +⌣ => ⌣ e28ca3 +⋆ => ⋆ e28b86 +☆ => ☆ e29886 +★ => ★ e29885 +ϵ => ϵ cfb5 +ϕ => Ï• cf95 +¯ => ¯ c2af +⊂ => ⊂ e28a82 +⫅ => â«… e2ab85 +⪽ => ⪽ e2aabd +⊆ => ⊆ e28a86 +⫃ => ⫃ e2ab83 +⫁ => â« e2ab81 +⫋ => â«‹ e2ab8b +⊊ => ⊊ e28a8a +⪿ => ⪿ e2aabf +⥹ => ⥹ e2a5b9 +⊂ => ⊂ e28a82 +⊆ => ⊆ e28a86 +⫅ => â«… e2ab85 +⊊ => ⊊ e28a8a +⫋ => â«‹ e2ab8b +⫇ => ⫇ e2ab87 +⫕ => â«• e2ab95 +⫓ => â«“ e2ab93 +≻ => ≻ e289bb +⪸ => ⪸ e2aab8 +≽ => ≽ e289bd +⪰ => ⪰ e2aab0 +⪺ => ⪺ e2aaba +⪶ => ⪶ e2aab6 +⋩ => â‹© e28ba9 +≿ => ≿ e289bf +∑ => ∑ e28891 +♪ => ♪ e299aa +⊃ => ⊃ e28a83 +¹ => ¹ c2b9 +² => ² c2b2 +³ => ³ c2b3 +⫆ => ⫆ e2ab86 +⪾ => ⪾ e2aabe +⫘ => ⫘ e2ab98 +⊇ => ⊇ e28a87 +⫄ => â«„ e2ab84 +⟉ => ⟉ e29f89 +⫗ => â«— e2ab97 +⥻ => ⥻ e2a5bb +⫂ => â«‚ e2ab82 +⫌ => ⫌ e2ab8c +⊋ => ⊋ e28a8b +⫀ => â«€ e2ab80 +⊃ => ⊃ e28a83 +⊇ => ⊇ e28a87 +⫆ => ⫆ e2ab86 +⊋ => ⊋ e28a8b +⫌ => ⫌ e2ab8c +⫈ => ⫈ e2ab88 +⫔ => â«” e2ab94 +⫖ => â«– e2ab96 +⇙ => ⇙ e28799 +⤦ => ⤦ e2a4a6 +↙ => ↙ e28699 +↙ => ↙ e28699 +⤪ => ⤪ e2a4aa +ß => ß c39f +⌖ => ⌖ e28c96 +τ => Ï„ cf84 +⎴ => ⎴ e28eb4 +ť => Å¥ c5a5 +ţ => Å£ c5a3 +т => Ñ‚ d182 +⃛ => ⃛ e2839b +⌕ => ⌕ e28c95 +𝔱 => ð”± f09d94b1 +∴ => ∴ e288b4 +∴ => ∴ e288b4 +θ => θ ceb8 +ϑ => Ï‘ cf91 +ϑ => Ï‘ cf91 +≈ => ≈ e28988 +∼ => ∼ e288bc +  =>   e28089 +≈ => ≈ e28988 +∼ => ∼ e288bc +þ => þ c3be +˜ => Ëœ cb9c +× => × c397 +⊠ => ⊠ e28aa0 +⨱ => ⨱ e2a8b1 +⨰ => ⨰ e2a8b0 +∭ => ∭ e288ad +⤨ => ⤨ e2a4a8 +⊤ => ⊤ e28aa4 +⌶ => ⌶ e28cb6 +⫱ => ⫱ e2abb1 +𝕥 => ð•¥ f09d95a5 +⫚ => ⫚ e2ab9a +⤩ => ⤩ e2a4a9 +‴ => ‴ e280b4 +™ => â„¢ e284a2 +▵ => â–µ e296b5 +▿ => â–¿ e296bf +◃ => â—ƒ e29783 +⊴ => ⊴ e28ab4 +≜ => ≜ e2899c +▹ => â–¹ e296b9 +⊵ => ⊵ e28ab5 +◬ => â—¬ e297ac +≜ => ≜ e2899c +⨺ => ⨺ e2a8ba +⨹ => ⨹ e2a8b9 +⧍ => â§ e2a78d +⨻ => ⨻ e2a8bb +⏢ => ⢠e28fa2 +𝓉 => 𓉠f09d9389 +ц => ц d186 +ћ => Ñ› d19b +ŧ => ŧ c5a7 +≬ => ≬ e289ac +↞ => ↞ e2869e +↠ => ↠ e286a0 +⇑ => ⇑ e28791 +⥣ => ⥣ e2a5a3 +ú => ú c3ba +↑ => ↑ e28691 +ў => Ñž d19e +ŭ => Å­ c5ad +û => û c3bb +у => у d183 +⇅ => ⇅ e28785 +ű => ű c5b1 +⥮ => ⥮ e2a5ae +⥾ => ⥾ e2a5be +𝔲 => 𔲠f09d94b2 +ù => ù c3b9 +↿ => ↿ e286bf +↾ => ↾ e286be +▀ => â–€ e29680 +⌜ => ⌜ e28c9c +⌜ => ⌜ e28c9c +⌏ => ⌠e28c8f +◸ => â—¸ e297b8 +ū => Å« c5ab +¨ => ¨ c2a8 +ų => ų c5b3 +𝕦 => 𕦠f09d95a6 +↑ => ↑ e28691 +↕ => ↕ e28695 +↿ => ↿ e286bf +↾ => ↾ e286be +⊎ => ⊎ e28a8e +υ => Ï… cf85 +ϒ => Ï’ cf92 +υ => Ï… cf85 +⇈ => ⇈ e28788 +⌝ => ⌠e28c9d +⌝ => ⌠e28c9d +⌎ => ⌎ e28c8e +ů => ů c5af +◹ => â—¹ e297b9 +𝓊 => 𓊠f09d938a +⋰ => â‹° e28bb0 +ũ => Å© c5a9 +▵ => â–µ e296b5 +▴ => â–´ e296b4 +⇈ => ⇈ e28788 +ü => ü c3bc +⦧ => ⦧ e2a6a7 +⇕ => ⇕ e28795 +⫨ => ⫨ e2aba8 +⫩ => â«© e2aba9 +⊨ => ⊨ e28aa8 +⦜ => ⦜ e2a69c +ϵ => ϵ cfb5 +ϰ => ϰ cfb0 +∅ => ∅ e28885 +ϕ => Ï• cf95 +ϖ => Ï– cf96 +∝ => ∠e2889d +↕ => ↕ e28695 +ϱ => ϱ cfb1 +ς => Ï‚ cf82 +⊊︀ => ⊊︀ e28a8aefb880 +⫋︀ => ⫋︀ e2ab8befb880 +⊋︀ => ⊋︀ e28a8befb880 +⫌︀ => ⫌︀ e2ab8cefb880 +ϑ => Ï‘ cf91 +⊲ => ⊲ e28ab2 +⊳ => ⊳ e28ab3 +в => в d0b2 +⊢ => ⊢ e28aa2 +∨ => ∨ e288a8 +⊻ => ⊻ e28abb +≚ => ≚ e2899a +⋮ => â‹® e28bae +| => | 7c +| => | 7c +𝔳 => 𔳠f09d94b3 +⊲ => ⊲ e28ab2 +⊂⃒ => ⊂⃒ e28a82e28392 +⊃⃒ => ⊃⃒ e28a83e28392 +𝕧 => ð•§ f09d95a7 +∝ => ∠e2889d +⊳ => ⊳ e28ab3 +𝓋 => ð“‹ f09d938b +⫋︀ => ⫋︀ e2ab8befb880 +⊊︀ => ⊊︀ e28a8aefb880 +⫌︀ => ⫌︀ e2ab8cefb880 +⊋︀ => ⊋︀ e28a8befb880 +⦚ => ⦚ e2a69a +ŵ => ŵ c5b5 +⩟ => ⩟ e2a99f +∧ => ∧ e288a7 +≙ => ≙ e28999 +℘ => ℘ e28498 +𝔴 => ð”´ f09d94b4 +𝕨 => 𕨠f09d95a8 +℘ => ℘ e28498 +≀ => ≀ e28980 +≀ => ≀ e28980 +𝓌 => 𓌠f09d938c +⋂ => â‹‚ e28b82 +◯ => â—¯ e297af +⋃ => ⋃ e28b83 +▽ => â–½ e296bd +𝔵 => 𔵠f09d94b5 +⟺ => ⟺ e29fba +⟷ => ⟷ e29fb7 +ξ => ξ cebe +⟸ => ⟸ e29fb8 +⟵ => ⟵ e29fb5 +⟼ => ⟼ e29fbc +⋻ => â‹» e28bbb +⨀ => ⨀ e2a880 +𝕩 => ð•© f09d95a9 +⨁ => ⨠e2a881 +⨂ => ⨂ e2a882 +⟹ => ⟹ e29fb9 +⟶ => ⟶ e29fb6 +𝓍 => ð“ f09d938d +⨆ => ⨆ e2a886 +⨄ => ⨄ e2a884 +△ => â–³ e296b3 +⋁ => â‹ e28b81 +⋀ => â‹€ e28b80 +ý => ý c3bd +я => Ñ d18f +ŷ => Å· c5b7 +ы => Ñ‹ d18b +¥ => Â¥ c2a5 +𝔶 => ð”¶ f09d94b6 +ї => Ñ— d197 +𝕪 => 𕪠f09d95aa +𝓎 => 𓎠f09d938e +ю => ÑŽ d18e +ÿ => ÿ c3bf +ź => ź c5ba +ž => ž c5be +з => з d0b7 +ż => ż c5bc +ℨ => ℨ e284a8 +ζ => ζ ceb6 +𝔷 => ð”· f09d94b7 +ж => ж d0b6 +⇝ => ⇠e2879d +𝕫 => ð•« f09d95ab +𝓏 => ð“ f09d938f +‍ => †e2808d +‌ => ‌ e2808c diff --git a/tests/std/strings/html_entity_decode_iso8859-15.phpt b/tests/std/strings/html_entity_decode_iso8859-15.phpt new file mode 100644 index 00000000..91bb9f14 --- /dev/null +++ b/tests/std/strings/html_entity_decode_iso8859-15.phpt @@ -0,0 +1,404 @@ +--TEST-- +Translation of HTML entities for encoding ISO-8859-15 +--FILE-- + array(0xA0, "NO-BREAK SPACE"), +0x00A1 => array(0xA1, "INVERTED EXCLAMATION MARK"), +0x00A2 => array(0xA2, "CENT SIGN"), +0x00A3 => array(0xA3, "POUND SIGN"), +0x20AC => array(0xA4, "EURO SIGN"), +0x00A5 => array(0xA5, "YEN SIGN"), +0x0160 => array(0xA6, "LATIN CAPITAL LETTER S WITH CARON"), +0x00A7 => array(0xA7, "SECTION SIGN"), +0x0161 => array(0xA8, "LATIN SMALL LETTER S WITH CARON"), +0x00A9 => array(0xA9, "COPYRIGHT SIGN"), +0x00AA => array(0xAA, "FEMININE ORDINAL INDICATOR"), +0x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x00AC => array(0xAC, "NOT SIGN"), +0x00AD => array(0xAD, "SOFT HYPHEN"), +0x00AE => array(0xAE, "REGISTERED SIGN"), +0x00AF => array(0xAF, "MACRON"), +0x00B0 => array(0xB0, "DEGREE SIGN"), +0x00B1 => array(0xB1, "PLUS-MINUS SIGN"), +0x00B2 => array(0xB2, "SUPERSCRIPT TWO"), +0x00B3 => array(0xB3, "SUPERSCRIPT THREE"), +0x017D => array(0xB4, "LATIN CAPITAL LETTER Z WITH CARON"), +0x00B5 => array(0xB5, "MICRO SIGN"), +0x00B6 => array(0xB6, "PILCROW SIGN"), +0x00B7 => array(0xB7, "MIDDLE DOT"), +0x017E => array(0xB8, "LATIN SMALL LETTER Z WITH CARON"), +0x00B9 => array(0xB9, "SUPERSCRIPT ONE"), +0x00BA => array(0xBA, "MASCULINE ORDINAL INDICATOR"), +0x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x0152 => array(0xBC, "LATIN CAPITAL LIGATURE OE"), +0x0153 => array(0xBD, "LATIN SMALL LIGATURE OE"), +0x0178 => array(0xBE, "LATIN CAPITAL LETTER Y WITH DIAERESIS"), +0x00BF => array(0xBF, "INVERTED QUESTION MARK"), +0x00C0 => array(0xC0, "LATIN CAPITAL LETTER A WITH GRAVE"), +0x00C1 => array(0xC1, "LATIN CAPITAL LETTER A WITH ACUTE"), +0x00C2 => array(0xC2, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"), +0x00C3 => array(0xC3, "LATIN CAPITAL LETTER A WITH TILDE"), +0x00C4 => array(0xC4, "LATIN CAPITAL LETTER A WITH DIAERESIS"), +0x00C5 => array(0xC5, "LATIN CAPITAL LETTER A WITH RING ABOVE"), +0x00C6 => array(0xC6, "LATIN CAPITAL LETTER AE"), +0x00C7 => array(0xC7, "LATIN CAPITAL LETTER C WITH CEDILLA"), +0x00C8 => array(0xC8, "LATIN CAPITAL LETTER E WITH GRAVE"), +0x00C9 => array(0xC9, "LATIN CAPITAL LETTER E WITH ACUTE"), +0x00CA => array(0xCA, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"), +0x00CB => array(0xCB, "LATIN CAPITAL LETTER E WITH DIAERESIS"), +0x00CC => array(0xCC, "LATIN CAPITAL LETTER I WITH GRAVE"), +0x00CD => array(0xCD, "LATIN CAPITAL LETTER I WITH ACUTE"), +0x00CE => array(0xCE, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"), +0x00CF => array(0xCF, "LATIN CAPITAL LETTER I WITH DIAERESIS"), +0x00D0 => array(0xD0, "LATIN CAPITAL LETTER ETH"), +0x00D1 => array(0xD1, "LATIN CAPITAL LETTER N WITH TILDE"), +0x00D2 => array(0xD2, "LATIN CAPITAL LETTER O WITH GRAVE"), +0x00D3 => array(0xD3, "LATIN CAPITAL LETTER O WITH ACUTE"), +0x00D4 => array(0xD4, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"), +0x00D5 => array(0xD5, "LATIN CAPITAL LETTER O WITH TILDE"), +0x00D6 => array(0xD6, "LATIN CAPITAL LETTER O WITH DIAERESIS"), +0x00D7 => array(0xD7, "MULTIPLICATION SIGN"), +0x00D8 => array(0xD8, "LATIN CAPITAL LETTER O WITH STROKE"), +0x00D9 => array(0xD9, "LATIN CAPITAL LETTER U WITH GRAVE"), +0x00DA => array(0xDA, "LATIN CAPITAL LETTER U WITH ACUTE"), +0x00DB => array(0xDB, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"), +0x00DC => array(0xDC, "LATIN CAPITAL LETTER U WITH DIAERESIS"), +0x00DD => array(0xDD, "LATIN CAPITAL LETTER Y WITH ACUTE"), +0x00DE => array(0xDE, "LATIN CAPITAL LETTER THORN"), +0x00DF => array(0xDF, "LATIN SMALL LETTER SHARP S"), +0x00E0 => array(0xE0, "LATIN SMALL LETTER A WITH GRAVE"), +0x00E1 => array(0xE1, "LATIN SMALL LETTER A WITH ACUTE"), +0x00E2 => array(0xE2, "LATIN SMALL LETTER A WITH CIRCUMFLEX"), +0x00E3 => array(0xE3, "LATIN SMALL LETTER A WITH TILDE"), +0x00E4 => array(0xE4, "LATIN SMALL LETTER A WITH DIAERESIS"), +0x00E5 => array(0xE5, "LATIN SMALL LETTER A WITH RING ABOVE"), +0x00E6 => array(0xE6, "LATIN SMALL LETTER AE"), +0x00E7 => array(0xE7, "LATIN SMALL LETTER C WITH CEDILLA"), +0x00E8 => array(0xE8, "LATIN SMALL LETTER E WITH GRAVE"), +0x00E9 => array(0xE9, "LATIN SMALL LETTER E WITH ACUTE"), +0x00EA => array(0xEA, "LATIN SMALL LETTER E WITH CIRCUMFLEX"), +0x00EB => array(0xEB, "LATIN SMALL LETTER E WITH DIAERESIS"), +0x00EC => array(0xEC, "LATIN SMALL LETTER I WITH GRAVE"), +0x00ED => array(0xED, "LATIN SMALL LETTER I WITH ACUTE"), +0x00EE => array(0xEE, "LATIN SMALL LETTER I WITH CIRCUMFLEX"), +0x00EF => array(0xEF, "LATIN SMALL LETTER I WITH DIAERESIS"), +0x00F0 => array(0xF0, "LATIN SMALL LETTER ETH"), +0x00F1 => array(0xF1, "LATIN SMALL LETTER N WITH TILDE"), +0x00F2 => array(0xF2, "LATIN SMALL LETTER O WITH GRAVE"), +0x00F3 => array(0xF3, "LATIN SMALL LETTER O WITH ACUTE"), +0x00F4 => array(0xF4, "LATIN SMALL LETTER O WITH CIRCUMFLEX"), +0x00F5 => array(0xF5, "LATIN SMALL LETTER O WITH TILDE"), +0x00F6 => array(0xF6, "LATIN SMALL LETTER O WITH DIAERESIS"), +0x00F7 => array(0xF7, "DIVISION SIGN"), +0x00F8 => array(0xF8, "LATIN SMALL LETTER O WITH STROKE"), +0x00F9 => array(0xF9, "LATIN SMALL LETTER U WITH GRAVE"), +0x00FA => array(0xFA, "LATIN SMALL LETTER U WITH ACUTE"), +0x00FB => array(0xFB, "LATIN SMALL LETTER U WITH CIRCUMFLEX"), +0x00FC => array(0xFC, "LATIN SMALL LETTER U WITH DIAERESIS"), +0x00FD => array(0xFD, "LATIN SMALL LETTER Y WITH ACUTE"), +0x00FE => array(0xFE, "LATIN SMALL LETTER THORN"), +0x00FF => array(0xFF, "LATIN SMALL LETTER Y WITH DIAERESIS"), +); + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +NO-BREAK SPACE:   => a0 +  => a0 + +INVERTED EXCLAMATION MARK: ¡ => a1 +¡ => a1 + +CENT SIGN: ¢ => a2 +¢ => a2 + +POUND SIGN: £ => a3 +£ => a3 + +EURO SIGN: € => a4 +¤ => ¤ + +YEN SIGN: ¥ => a5 +¥ => a5 + +LATIN CAPITAL LETTER S WITH CARON: Š => a6 +¦ => ¦ + +SECTION SIGN: § => a7 +§ => a7 + +LATIN SMALL LETTER S WITH CARON: š => a8 +¨ => ¨ + +COPYRIGHT SIGN: © => a9 +© => a9 + +FEMININE ORDINAL INDICATOR: ª => aa +ª => aa + +LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => ab +« => ab + +NOT SIGN: ¬ => ac +¬ => ac + +SOFT HYPHEN: ­ => ad +­ => ad + +REGISTERED SIGN: ® => ae +® => ae + +MACRON: ¯ => af +¯ => af + +DEGREE SIGN: ° => b0 +° => b0 + +PLUS-MINUS SIGN: ± => b1 +± => b1 + +SUPERSCRIPT TWO: ² => b2 +² => b2 + +SUPERSCRIPT THREE: ³ => b3 +³ => b3 + +LATIN CAPITAL LETTER Z WITH CARON: Ž => b4 +´ => ´ + +MICRO SIGN: µ => b5 +µ => b5 + +PILCROW SIGN: ¶ => b6 +¶ => b6 + +MIDDLE DOT: · => b7 +· => b7 + +LATIN SMALL LETTER Z WITH CARON: ž => b8 +¸ => ¸ + +SUPERSCRIPT ONE: ¹ => b9 +¹ => b9 + +MASCULINE ORDINAL INDICATOR: º => ba +º => ba + +RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => bb +» => bb + +LATIN CAPITAL LIGATURE OE: Œ => bc +¼ => ¼ + +LATIN SMALL LIGATURE OE: œ => bd +½ => ½ + +LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => be +¾ => ¾ + +INVERTED QUESTION MARK: ¿ => bf +¿ => bf + +LATIN CAPITAL LETTER A WITH GRAVE: À => c0 +À => c0 + +LATIN CAPITAL LETTER A WITH ACUTE: Á => c1 +Á => c1 + +LATIN CAPITAL LETTER A WITH CIRCUMFLEX:  => c2 + => c2 + +LATIN CAPITAL LETTER A WITH TILDE: à => c3 +à => c3 + +LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => c4 +Ä => c4 + +LATIN CAPITAL LETTER A WITH RING ABOVE: Å => c5 +Å => c5 + +LATIN CAPITAL LETTER AE: Æ => c6 +Æ => c6 + +LATIN CAPITAL LETTER C WITH CEDILLA: Ç => c7 +Ç => c7 + +LATIN CAPITAL LETTER E WITH GRAVE: È => c8 +È => c8 + +LATIN CAPITAL LETTER E WITH ACUTE: É => c9 +É => c9 + +LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => ca +Ê => ca + +LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => cb +Ë => cb + +LATIN CAPITAL LETTER I WITH GRAVE: Ì => cc +Ì => cc + +LATIN CAPITAL LETTER I WITH ACUTE: Í => cd +Í => cd + +LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => ce +Î => ce + +LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => cf +Ï => cf + +LATIN CAPITAL LETTER ETH: Ð => d0 +Ð => d0 + +LATIN CAPITAL LETTER N WITH TILDE: Ñ => d1 +Ñ => d1 + +LATIN CAPITAL LETTER O WITH GRAVE: Ò => d2 +Ò => d2 + +LATIN CAPITAL LETTER O WITH ACUTE: Ó => d3 +Ó => d3 + +LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => d4 +Ô => d4 + +LATIN CAPITAL LETTER O WITH TILDE: Õ => d5 +Õ => d5 + +LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => d6 +Ö => d6 + +MULTIPLICATION SIGN: × => d7 +× => d7 + +LATIN CAPITAL LETTER O WITH STROKE: Ø => d8 +Ø => d8 + +LATIN CAPITAL LETTER U WITH GRAVE: Ù => d9 +Ù => d9 + +LATIN CAPITAL LETTER U WITH ACUTE: Ú => da +Ú => da + +LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => db +Û => db + +LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => dc +Ü => dc + +LATIN CAPITAL LETTER Y WITH ACUTE: Ý => dd +Ý => dd + +LATIN CAPITAL LETTER THORN: Þ => de +Þ => de + +LATIN SMALL LETTER SHARP S: ß => df +ß => df + +LATIN SMALL LETTER A WITH GRAVE: à => e0 +à => e0 + +LATIN SMALL LETTER A WITH ACUTE: á => e1 +á => e1 + +LATIN SMALL LETTER A WITH CIRCUMFLEX: â => e2 +â => e2 + +LATIN SMALL LETTER A WITH TILDE: ã => e3 +ã => e3 + +LATIN SMALL LETTER A WITH DIAERESIS: ä => e4 +ä => e4 + +LATIN SMALL LETTER A WITH RING ABOVE: å => e5 +å => e5 + +LATIN SMALL LETTER AE: æ => e6 +æ => e6 + +LATIN SMALL LETTER C WITH CEDILLA: ç => e7 +ç => e7 + +LATIN SMALL LETTER E WITH GRAVE: è => e8 +è => e8 + +LATIN SMALL LETTER E WITH ACUTE: é => e9 +é => e9 + +LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => ea +ê => ea + +LATIN SMALL LETTER E WITH DIAERESIS: ë => eb +ë => eb + +LATIN SMALL LETTER I WITH GRAVE: ì => ec +ì => ec + +LATIN SMALL LETTER I WITH ACUTE: í => ed +í => ed + +LATIN SMALL LETTER I WITH CIRCUMFLEX: î => ee +î => ee + +LATIN SMALL LETTER I WITH DIAERESIS: ï => ef +ï => ef + +LATIN SMALL LETTER ETH: ð => f0 +ð => f0 + +LATIN SMALL LETTER N WITH TILDE: ñ => f1 +ñ => f1 + +LATIN SMALL LETTER O WITH GRAVE: ò => f2 +ò => f2 + +LATIN SMALL LETTER O WITH ACUTE: ó => f3 +ó => f3 + +LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => f4 +ô => f4 + +LATIN SMALL LETTER O WITH TILDE: õ => f5 +õ => f5 + +LATIN SMALL LETTER O WITH DIAERESIS: ö => f6 +ö => f6 + +DIVISION SIGN: ÷ => f7 +÷ => f7 + +LATIN SMALL LETTER O WITH STROKE: ø => f8 +ø => f8 + +LATIN SMALL LETTER U WITH GRAVE: ù => f9 +ù => f9 + +LATIN SMALL LETTER U WITH ACUTE: ú => fa +ú => fa + +LATIN SMALL LETTER U WITH CIRCUMFLEX: û => fb +û => fb + +LATIN SMALL LETTER U WITH DIAERESIS: ü => fc +ü => fc + +LATIN SMALL LETTER Y WITH ACUTE: ý => fd +ý => fd + +LATIN SMALL LETTER THORN: þ => fe +þ => fe + +LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => ff +ÿ => ff diff --git a/tests/std/strings/html_entity_decode_iso8859-5.phpt b/tests/std/strings/html_entity_decode_iso8859-5.phpt new file mode 100644 index 00000000..0616827c --- /dev/null +++ b/tests/std/strings/html_entity_decode_iso8859-5.phpt @@ -0,0 +1,404 @@ +--TEST-- +Translation of HTML entities for encoding ISO-8859-5 +--FILE-- + array(0xA0, "NO-BREAK SPACE"), +0x0401 => array(0xA1, "CYRILLIC CAPITAL LETTER IO"), +0x0402 => array(0xA2, "CYRILLIC CAPITAL LETTER DJE"), +0x0403 => array(0xA3, "CYRILLIC CAPITAL LETTER GJE"), +0x0404 => array(0xA4, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"), +0x0405 => array(0xA5, "CYRILLIC CAPITAL LETTER DZE"), +0x0406 => array(0xA6, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"), +0x0407 => array(0xA7, "CYRILLIC CAPITAL LETTER YI"), +0x0408 => array(0xA8, "CYRILLIC CAPITAL LETTER JE"), +0x0409 => array(0xA9, "CYRILLIC CAPITAL LETTER LJE"), +0x040A => array(0xAA, "CYRILLIC CAPITAL LETTER NJE"), +0x040B => array(0xAB, "CYRILLIC CAPITAL LETTER TSHE"), +0x040C => array(0xAC, "CYRILLIC CAPITAL LETTER KJE"), +0x00AD => array(0xAD, "SOFT HYPHEN"), +0x040E => array(0xAE, "CYRILLIC CAPITAL LETTER SHORT U"), +0x040F => array(0xAF, "CYRILLIC CAPITAL LETTER DZHE"), +0x0410 => array(0xB0, "CYRILLIC CAPITAL LETTER A"), +0x0411 => array(0xB1, "CYRILLIC CAPITAL LETTER BE"), +0x0412 => array(0xB2, "CYRILLIC CAPITAL LETTER VE"), +0x0413 => array(0xB3, "CYRILLIC CAPITAL LETTER GHE"), +0x0414 => array(0xB4, "CYRILLIC CAPITAL LETTER DE"), +0x0415 => array(0xB5, "CYRILLIC CAPITAL LETTER IE"), +0x0416 => array(0xB6, "CYRILLIC CAPITAL LETTER ZHE"), +0x0417 => array(0xB7, "CYRILLIC CAPITAL LETTER ZE"), +0x0418 => array(0xB8, "CYRILLIC CAPITAL LETTER I"), +0x0419 => array(0xB9, "CYRILLIC CAPITAL LETTER SHORT I"), +0x041A => array(0xBA, "CYRILLIC CAPITAL LETTER KA"), +0x041B => array(0xBB, "CYRILLIC CAPITAL LETTER EL"), +0x041C => array(0xBC, "CYRILLIC CAPITAL LETTER EM"), +0x041D => array(0xBD, "CYRILLIC CAPITAL LETTER EN"), +0x041E => array(0xBE, "CYRILLIC CAPITAL LETTER O"), +0x041F => array(0xBF, "CYRILLIC CAPITAL LETTER PE"), +0x0420 => array(0xC0, "CYRILLIC CAPITAL LETTER ER"), +0x0421 => array(0xC1, "CYRILLIC CAPITAL LETTER ES"), +0x0422 => array(0xC2, "CYRILLIC CAPITAL LETTER TE"), +0x0423 => array(0xC3, "CYRILLIC CAPITAL LETTER U"), +0x0424 => array(0xC4, "CYRILLIC CAPITAL LETTER EF"), +0x0425 => array(0xC5, "CYRILLIC CAPITAL LETTER HA"), +0x0426 => array(0xC6, "CYRILLIC CAPITAL LETTER TSE"), +0x0427 => array(0xC7, "CYRILLIC CAPITAL LETTER CHE"), +0x0428 => array(0xC8, "CYRILLIC CAPITAL LETTER SHA"), +0x0429 => array(0xC9, "CYRILLIC CAPITAL LETTER SHCHA"), +0x042A => array(0xCA, "CYRILLIC CAPITAL LETTER HARD SIGN"), +0x042B => array(0xCB, "CYRILLIC CAPITAL LETTER YERU"), +0x042C => array(0xCC, "CYRILLIC CAPITAL LETTER SOFT SIGN"), +0x042D => array(0xCD, "CYRILLIC CAPITAL LETTER E"), +0x042E => array(0xCE, "CYRILLIC CAPITAL LETTER YU"), +0x042F => array(0xCF, "CYRILLIC CAPITAL LETTER YA"), +0x0430 => array(0xD0, "CYRILLIC SMALL LETTER A"), +0x0431 => array(0xD1, "CYRILLIC SMALL LETTER BE"), +0x0432 => array(0xD2, "CYRILLIC SMALL LETTER VE"), +0x0433 => array(0xD3, "CYRILLIC SMALL LETTER GHE"), +0x0434 => array(0xD4, "CYRILLIC SMALL LETTER DE"), +0x0435 => array(0xD5, "CYRILLIC SMALL LETTER IE"), +0x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"), +0x0437 => array(0xD7, "CYRILLIC SMALL LETTER ZE"), +0x0438 => array(0xD8, "CYRILLIC SMALL LETTER I"), +0x0439 => array(0xD9, "CYRILLIC SMALL LETTER SHORT I"), +0x043A => array(0xDA, "CYRILLIC SMALL LETTER KA"), +0x043B => array(0xDB, "CYRILLIC SMALL LETTER EL"), +0x043C => array(0xDC, "CYRILLIC SMALL LETTER EM"), +0x043D => array(0xDD, "CYRILLIC SMALL LETTER EN"), +0x043E => array(0xDE, "CYRILLIC SMALL LETTER O"), +0x043F => array(0xDF, "CYRILLIC SMALL LETTER PE"), +0x0440 => array(0xE0, "CYRILLIC SMALL LETTER ER"), +0x0441 => array(0xE1, "CYRILLIC SMALL LETTER ES"), +0x0442 => array(0xE2, "CYRILLIC SMALL LETTER TE"), +0x0443 => array(0xE3, "CYRILLIC SMALL LETTER U"), +0x0444 => array(0xE4, "CYRILLIC SMALL LETTER EF"), +0x0445 => array(0xE5, "CYRILLIC SMALL LETTER HA"), +0x0446 => array(0xE6, "CYRILLIC SMALL LETTER TSE"), +0x0447 => array(0xE7, "CYRILLIC SMALL LETTER CHE"), +0x0448 => array(0xE8, "CYRILLIC SMALL LETTER SHA"), +0x0449 => array(0xE9, "CYRILLIC SMALL LETTER SHCHA"), +0x044A => array(0xEA, "CYRILLIC SMALL LETTER HARD SIGN"), +0x044B => array(0xEB, "CYRILLIC SMALL LETTER YERU"), +0x044C => array(0xEC, "CYRILLIC SMALL LETTER SOFT SIGN"), +0x044D => array(0xED, "CYRILLIC SMALL LETTER E"), +0x044E => array(0xEE, "CYRILLIC SMALL LETTER YU"), +0x044F => array(0xEF, "CYRILLIC SMALL LETTER YA"), +0x2116 => array(0xF0, "NUMERO SIGN"), +0x0451 => array(0xF1, "CYRILLIC SMALL LETTER IO"), +0x0452 => array(0xF2, "CYRILLIC SMALL LETTER DJE"), +0x0453 => array(0xF3, "CYRILLIC SMALL LETTER GJE"), +0x0454 => array(0xF4, "CYRILLIC SMALL LETTER UKRAINIAN IE"), +0x0455 => array(0xF5, "CYRILLIC SMALL LETTER DZE"), +0x0456 => array(0xF6, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"), +0x0457 => array(0xF7, "CYRILLIC SMALL LETTER YI"), +0x0458 => array(0xF8, "CYRILLIC SMALL LETTER JE"), +0x0459 => array(0xF9, "CYRILLIC SMALL LETTER LJE"), +0x045A => array(0xFA, "CYRILLIC SMALL LETTER NJE"), +0x045B => array(0xFB, "CYRILLIC SMALL LETTER TSHE"), +0x045C => array(0xFC, "CYRILLIC SMALL LETTER KJE"), +0x00A7 => array(0xFD, "SECTION SIGN"), +0x045E => array(0xFE, "CYRILLIC SMALL LETTER SHORT U"), +0x045F => array(0xFF, "CYRILLIC SMALL LETTER DZHE"), +); + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-5'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-5'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +NO-BREAK SPACE:   => a0 +  => a0 + +CYRILLIC CAPITAL LETTER IO: Ё => a1 +¡ => ¡ + +CYRILLIC CAPITAL LETTER DJE: Ђ => a2 +¢ => ¢ + +CYRILLIC CAPITAL LETTER GJE: Ѓ => a3 +£ => £ + +CYRILLIC CAPITAL LETTER UKRAINIAN IE: Є => a4 +¤ => ¤ + +CYRILLIC CAPITAL LETTER DZE: Ѕ => a5 +¥ => ¥ + +CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: І => a6 +¦ => ¦ + +CYRILLIC CAPITAL LETTER YI: Ї => a7 +§ => fd + +CYRILLIC CAPITAL LETTER JE: Ј => a8 +¨ => ¨ + +CYRILLIC CAPITAL LETTER LJE: Љ => a9 +© => © + +CYRILLIC CAPITAL LETTER NJE: Њ => aa +ª => ª + +CYRILLIC CAPITAL LETTER TSHE: Ћ => ab +« => « + +CYRILLIC CAPITAL LETTER KJE: Ќ => ac +¬ => ¬ + +SOFT HYPHEN: ­ => ad +­ => ad + +CYRILLIC CAPITAL LETTER SHORT U: Ў => ae +® => ® + +CYRILLIC CAPITAL LETTER DZHE: Џ => af +¯ => ¯ + +CYRILLIC CAPITAL LETTER A: А => b0 +° => ° + +CYRILLIC CAPITAL LETTER BE: Б => b1 +± => ± + +CYRILLIC CAPITAL LETTER VE: В => b2 +² => ² + +CYRILLIC CAPITAL LETTER GHE: Г => b3 +³ => ³ + +CYRILLIC CAPITAL LETTER DE: Д => b4 +´ => ´ + +CYRILLIC CAPITAL LETTER IE: Е => b5 +µ => µ + +CYRILLIC CAPITAL LETTER ZHE: Ж => b6 +¶ => ¶ + +CYRILLIC CAPITAL LETTER ZE: З => b7 +· => · + +CYRILLIC CAPITAL LETTER I: И => b8 +¸ => ¸ + +CYRILLIC CAPITAL LETTER SHORT I: Й => b9 +¹ => ¹ + +CYRILLIC CAPITAL LETTER KA: К => ba +º => º + +CYRILLIC CAPITAL LETTER EL: Л => bb +» => » + +CYRILLIC CAPITAL LETTER EM: М => bc +¼ => ¼ + +CYRILLIC CAPITAL LETTER EN: Н => bd +½ => ½ + +CYRILLIC CAPITAL LETTER O: О => be +¾ => ¾ + +CYRILLIC CAPITAL LETTER PE: П => bf +¿ => ¿ + +CYRILLIC CAPITAL LETTER ER: Р => c0 +À => À + +CYRILLIC CAPITAL LETTER ES: С => c1 +Á => Á + +CYRILLIC CAPITAL LETTER TE: Т => c2 + =>  + +CYRILLIC CAPITAL LETTER U: У => c3 +à => à + +CYRILLIC CAPITAL LETTER EF: Ф => c4 +Ä => Ä + +CYRILLIC CAPITAL LETTER HA: Х => c5 +Å => Å + +CYRILLIC CAPITAL LETTER TSE: Ц => c6 +Æ => Æ + +CYRILLIC CAPITAL LETTER CHE: Ч => c7 +Ç => Ç + +CYRILLIC CAPITAL LETTER SHA: Ш => c8 +È => È + +CYRILLIC CAPITAL LETTER SHCHA: Щ => c9 +É => É + +CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => ca +Ê => Ê + +CYRILLIC CAPITAL LETTER YERU: Ы => cb +Ë => Ë + +CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => cc +Ì => Ì + +CYRILLIC CAPITAL LETTER E: Э => cd +Í => Í + +CYRILLIC CAPITAL LETTER YU: Ю => ce +Î => Î + +CYRILLIC CAPITAL LETTER YA: Я => cf +Ï => Ï + +CYRILLIC SMALL LETTER A: а => d0 +Ð => Ð + +CYRILLIC SMALL LETTER BE: б => d1 +Ñ => Ñ + +CYRILLIC SMALL LETTER VE: в => d2 +Ò => Ò + +CYRILLIC SMALL LETTER GHE: г => d3 +Ó => Ó + +CYRILLIC SMALL LETTER DE: д => d4 +Ô => Ô + +CYRILLIC SMALL LETTER IE: е => d5 +Õ => Õ + +CYRILLIC SMALL LETTER ZHE: ж => d6 +Ö => Ö + +CYRILLIC SMALL LETTER ZE: з => d7 +× => × + +CYRILLIC SMALL LETTER I: и => d8 +Ø => Ø + +CYRILLIC SMALL LETTER SHORT I: й => d9 +Ù => Ù + +CYRILLIC SMALL LETTER KA: к => da +Ú => Ú + +CYRILLIC SMALL LETTER EL: л => db +Û => Û + +CYRILLIC SMALL LETTER EM: м => dc +Ü => Ü + +CYRILLIC SMALL LETTER EN: н => dd +Ý => Ý + +CYRILLIC SMALL LETTER O: о => de +Þ => Þ + +CYRILLIC SMALL LETTER PE: п => df +ß => ß + +CYRILLIC SMALL LETTER ER: р => e0 +à => à + +CYRILLIC SMALL LETTER ES: с => e1 +á => á + +CYRILLIC SMALL LETTER TE: т => e2 +â => â + +CYRILLIC SMALL LETTER U: у => e3 +ã => ã + +CYRILLIC SMALL LETTER EF: ф => e4 +ä => ä + +CYRILLIC SMALL LETTER HA: х => e5 +å => å + +CYRILLIC SMALL LETTER TSE: ц => e6 +æ => æ + +CYRILLIC SMALL LETTER CHE: ч => e7 +ç => ç + +CYRILLIC SMALL LETTER SHA: ш => e8 +è => è + +CYRILLIC SMALL LETTER SHCHA: щ => e9 +é => é + +CYRILLIC SMALL LETTER HARD SIGN: ъ => ea +ê => ê + +CYRILLIC SMALL LETTER YERU: ы => eb +ë => ë + +CYRILLIC SMALL LETTER SOFT SIGN: ь => ec +ì => ì + +CYRILLIC SMALL LETTER E: э => ed +í => í + +CYRILLIC SMALL LETTER YU: ю => ee +î => î + +CYRILLIC SMALL LETTER YA: я => ef +ï => ï + +NUMERO SIGN: № => f0 +ð => ð + +CYRILLIC SMALL LETTER IO: ё => f1 +ñ => ñ + +CYRILLIC SMALL LETTER DJE: ђ => f2 +ò => ò + +CYRILLIC SMALL LETTER GJE: ѓ => f3 +ó => ó + +CYRILLIC SMALL LETTER UKRAINIAN IE: є => f4 +ô => ô + +CYRILLIC SMALL LETTER DZE: ѕ => f5 +õ => õ + +CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: і => f6 +ö => ö + +CYRILLIC SMALL LETTER YI: ї => f7 +÷ => ÷ + +CYRILLIC SMALL LETTER JE: ј => f8 +ø => ø + +CYRILLIC SMALL LETTER LJE: љ => f9 +ù => ù + +CYRILLIC SMALL LETTER NJE: њ => fa +ú => ú + +CYRILLIC SMALL LETTER TSHE: ћ => fb +û => û + +CYRILLIC SMALL LETTER KJE: ќ => fc +ü => ü + +SECTION SIGN: § => fd +ý => ý + +CYRILLIC SMALL LETTER SHORT U: ў => fe +þ => þ + +CYRILLIC SMALL LETTER DZHE: џ => ff +ÿ => ÿ diff --git a/tests/std/strings/html_entity_decode_koi8-r.phpt b/tests/std/strings/html_entity_decode_koi8-r.phpt new file mode 100644 index 00000000..bd9aad61 --- /dev/null +++ b/tests/std/strings/html_entity_decode_koi8-r.phpt @@ -0,0 +1,532 @@ +--TEST-- +Translation of HTML entities for encoding KOI8-R +--FILE-- + array(0x80, "BOX DRAWINGS LIGHT HORIZONTAL"), +0x2502 => array(0x81, "BOX DRAWINGS LIGHT VERTICAL"), +0x250C => array(0x82, "BOX DRAWINGS LIGHT DOWN AND RIGHT"), +0x2510 => array(0x83, "BOX DRAWINGS LIGHT DOWN AND LEFT"), +0x2514 => array(0x84, "BOX DRAWINGS LIGHT UP AND RIGHT"), +0x2518 => array(0x85, "BOX DRAWINGS LIGHT UP AND LEFT"), +0x251C => array(0x86, "BOX DRAWINGS LIGHT VERTICAL AND RIGHT"), +0x2524 => array(0x87, "BOX DRAWINGS LIGHT VERTICAL AND LEFT"), +0x252C => array(0x88, "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL"), +0x2534 => array(0x89, "BOX DRAWINGS LIGHT UP AND HORIZONTAL"), +0x253C => array(0x8A, "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL"), +0x2580 => array(0x8B, "UPPER HALF BLOCK"), +0x2584 => array(0x8C, "LOWER HALF BLOCK"), +0x2588 => array(0x8D, "FULL BLOCK"), +0x258C => array(0x8E, "LEFT HALF BLOCK"), +0x2590 => array(0x8F, "RIGHT HALF BLOCK"), +0x2591 => array(0x90, "LIGHT SHADE"), +0x2592 => array(0x91, "MEDIUM SHADE"), +0x2593 => array(0x92, "DARK SHADE"), +0x2320 => array(0x93, "TOP HALF INTEGRAL"), +0x25A0 => array(0x94, "BLACK SQUARE"), +0x2219 => array(0x95, "BULLET OPERATOR"), +0x221A => array(0x96, "SQUARE ROOT"), +0x2248 => array(0x97, "ALMOST EQUAL TO"), +0x2264 => array(0x98, "LESS-THAN OR EQUAL TO"), +0x2265 => array(0x99, "GREATER-THAN OR EQUAL TO"), +0x00A0 => array(0x9A, "NO-BREAK SPACE"), +0x2321 => array(0x9B, "BOTTOM HALF INTEGRAL"), +0x00B0 => array(0x9C, "DEGREE SIGN"), +0x00B2 => array(0x9D, "SUPERSCRIPT TWO"), +0x00B7 => array(0x9E, "MIDDLE DOT"), +0x00F7 => array(0x9F, "DIVISION SIGN"), +0x2550 => array(0xA0, "BOX DRAWINGS DOUBLE HORIZONTAL"), +0x2551 => array(0xA1, "BOX DRAWINGS DOUBLE VERTICAL"), +0x2552 => array(0xA2, "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE"), +0x0451 => array(0xA3, "CYRILLIC SMALL LETTER IO"), +0x2553 => array(0xA4, "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE"), +0x2554 => array(0xA5, "BOX DRAWINGS DOUBLE DOWN AND RIGHT"), +0x2555 => array(0xA6, "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE"), +0x2556 => array(0xA7, "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE"), +0x2557 => array(0xA8, "BOX DRAWINGS DOUBLE DOWN AND LEFT"), +0x2558 => array(0xA9, "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE"), +0x2559 => array(0xAA, "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE"), +0x255A => array(0xAB, "BOX DRAWINGS DOUBLE UP AND RIGHT"), +0x255B => array(0xAC, "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE"), +0x255C => array(0xAD, "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE"), +0x255D => array(0xAE, "BOX DRAWINGS DOUBLE UP AND LEFT"), +0x255E => array(0xAF, "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE"), +0x255F => array(0xB0, "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE"), +0x2560 => array(0xB1, "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT"), +0x2561 => array(0xB2, "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE"), +0x0401 => array(0xB3, "CYRILLIC CAPITAL LETTER IO"), +0x2562 => array(0xB4, "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE"), +0x2563 => array(0xB5, "BOX DRAWINGS DOUBLE VERTICAL AND LEFT"), +0x2564 => array(0xB6, "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE"), +0x2565 => array(0xB7, "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE"), +0x2566 => array(0xB8, "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL"), +0x2567 => array(0xB9, "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE"), +0x2568 => array(0xBA, "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE"), +0x2569 => array(0xBB, "BOX DRAWINGS DOUBLE UP AND HORIZONTAL"), +0x256A => array(0xBC, "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE"), +0x256B => array(0xBD, "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE"), +0x256C => array(0xBE, "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL"), +0x00A9 => array(0xBF, "COPYRIGHT SIGN"), +0x044E => array(0xC0, "CYRILLIC SMALL LETTER YU"), +0x0430 => array(0xC1, "CYRILLIC SMALL LETTER A"), +0x0431 => array(0xC2, "CYRILLIC SMALL LETTER BE"), +0x0446 => array(0xC3, "CYRILLIC SMALL LETTER TSE"), +0x0434 => array(0xC4, "CYRILLIC SMALL LETTER DE"), +0x0435 => array(0xC5, "CYRILLIC SMALL LETTER IE"), +0x0444 => array(0xC6, "CYRILLIC SMALL LETTER EF"), +0x0433 => array(0xC7, "CYRILLIC SMALL LETTER GHE"), +0x0445 => array(0xC8, "CYRILLIC SMALL LETTER HA"), +0x0438 => array(0xC9, "CYRILLIC SMALL LETTER I"), +0x0439 => array(0xCA, "CYRILLIC SMALL LETTER SHORT I"), +0x043A => array(0xCB, "CYRILLIC SMALL LETTER KA"), +0x043B => array(0xCC, "CYRILLIC SMALL LETTER EL"), +0x043C => array(0xCD, "CYRILLIC SMALL LETTER EM"), +0x043D => array(0xCE, "CYRILLIC SMALL LETTER EN"), +0x043E => array(0xCF, "CYRILLIC SMALL LETTER O"), +0x043F => array(0xD0, "CYRILLIC SMALL LETTER PE"), +0x044F => array(0xD1, "CYRILLIC SMALL LETTER YA"), +0x0440 => array(0xD2, "CYRILLIC SMALL LETTER ER"), +0x0441 => array(0xD3, "CYRILLIC SMALL LETTER ES"), +0x0442 => array(0xD4, "CYRILLIC SMALL LETTER TE"), +0x0443 => array(0xD5, "CYRILLIC SMALL LETTER U"), +0x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"), +0x0432 => array(0xD7, "CYRILLIC SMALL LETTER VE"), +0x044C => array(0xD8, "CYRILLIC SMALL LETTER SOFT SIGN"), +0x044B => array(0xD9, "CYRILLIC SMALL LETTER YERU"), +0x0437 => array(0xDA, "CYRILLIC SMALL LETTER ZE"), +0x0448 => array(0xDB, "CYRILLIC SMALL LETTER SHA"), +0x044D => array(0xDC, "CYRILLIC SMALL LETTER E"), +0x0449 => array(0xDD, "CYRILLIC SMALL LETTER SHCHA"), +0x0447 => array(0xDE, "CYRILLIC SMALL LETTER CHE"), +0x044A => array(0xDF, "CYRILLIC SMALL LETTER HARD SIGN"), +0x042E => array(0xE0, "CYRILLIC CAPITAL LETTER YU"), +0x0410 => array(0xE1, "CYRILLIC CAPITAL LETTER A"), +0x0411 => array(0xE2, "CYRILLIC CAPITAL LETTER BE"), +0x0426 => array(0xE3, "CYRILLIC CAPITAL LETTER TSE"), +0x0414 => array(0xE4, "CYRILLIC CAPITAL LETTER DE"), +0x0415 => array(0xE5, "CYRILLIC CAPITAL LETTER IE"), +0x0424 => array(0xE6, "CYRILLIC CAPITAL LETTER EF"), +0x0413 => array(0xE7, "CYRILLIC CAPITAL LETTER GHE"), +0x0425 => array(0xE8, "CYRILLIC CAPITAL LETTER HA"), +0x0418 => array(0xE9, "CYRILLIC CAPITAL LETTER I"), +0x0419 => array(0xEA, "CYRILLIC CAPITAL LETTER SHORT I"), +0x041A => array(0xEB, "CYRILLIC CAPITAL LETTER KA"), +0x041B => array(0xEC, "CYRILLIC CAPITAL LETTER EL"), +0x041C => array(0xED, "CYRILLIC CAPITAL LETTER EM"), +0x041D => array(0xEE, "CYRILLIC CAPITAL LETTER EN"), +0x041E => array(0xEF, "CYRILLIC CAPITAL LETTER O"), +0x041F => array(0xF0, "CYRILLIC CAPITAL LETTER PE"), +0x042F => array(0xF1, "CYRILLIC CAPITAL LETTER YA"), +0x0420 => array(0xF2, "CYRILLIC CAPITAL LETTER ER"), +0x0421 => array(0xF3, "CYRILLIC CAPITAL LETTER ES"), +0x0422 => array(0xF4, "CYRILLIC CAPITAL LETTER TE"), +0x0423 => array(0xF5, "CYRILLIC CAPITAL LETTER U"), +0x0416 => array(0xF6, "CYRILLIC CAPITAL LETTER ZHE"), +0x0412 => array(0xF7, "CYRILLIC CAPITAL LETTER VE"), +0x042C => array(0xF8, "CYRILLIC CAPITAL LETTER SOFT SIGN"), +0x042B => array(0xF9, "CYRILLIC CAPITAL LETTER YERU"), +0x0417 => array(0xFA, "CYRILLIC CAPITAL LETTER ZE"), +0x0428 => array(0xFB, "CYRILLIC CAPITAL LETTER SHA"), +0x042D => array(0xFC, "CYRILLIC CAPITAL LETTER E"), +0x0429 => array(0xFD, "CYRILLIC CAPITAL LETTER SHCHA"), +0x0427 => array(0xFE, "CYRILLIC CAPITAL LETTER CHE"), +0x042A => array(0xFF, "CYRILLIC CAPITAL LETTER HARD SIGN"), +); + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +BOX DRAWINGS LIGHT HORIZONTAL: ─ => 80 +€ => € + +BOX DRAWINGS LIGHT VERTICAL: │ => 81 + =>  + +BOX DRAWINGS LIGHT DOWN AND RIGHT: ┌ => 82 +‚ => ‚ + +BOX DRAWINGS LIGHT DOWN AND LEFT: ┐ => 83 +ƒ => ƒ + +BOX DRAWINGS LIGHT UP AND RIGHT: └ => 84 +„ => „ + +BOX DRAWINGS LIGHT UP AND LEFT: ┘ => 85 +… => … + +BOX DRAWINGS LIGHT VERTICAL AND RIGHT: ├ => 86 +† => † + +BOX DRAWINGS LIGHT VERTICAL AND LEFT: ┤ => 87 +‡ => ‡ + +BOX DRAWINGS LIGHT DOWN AND HORIZONTAL: ┬ => 88 +ˆ => ˆ + +BOX DRAWINGS LIGHT UP AND HORIZONTAL: ┴ => 89 +‰ => ‰ + +BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL: ┼ => 8a +Š => Š + +UPPER HALF BLOCK: ▀ => 8b +‹ => ‹ + +LOWER HALF BLOCK: ▄ => 8c +Œ => Œ + +FULL BLOCK: █ => 8d + =>  + +LEFT HALF BLOCK: ▌ => 8e +Ž => Ž + +RIGHT HALF BLOCK: ▐ => 8f + =>  + +LIGHT SHADE: ░ => 90 + =>  + +MEDIUM SHADE: ▒ => 91 +‘ => ‘ + +DARK SHADE: ▓ => 92 +’ => ’ + +TOP HALF INTEGRAL: ⌠ => 93 +“ => “ + +BLACK SQUARE: ■ => 94 +” => ” + +BULLET OPERATOR: ∙ => 95 +• => • + +SQUARE ROOT: √ => 96 +– => – + +ALMOST EQUAL TO: ≈ => 97 +— => — + +LESS-THAN OR EQUAL TO: ≤ => 98 +˜ => ˜ + +GREATER-THAN OR EQUAL TO: ≥ => 99 +™ => ™ + +NO-BREAK SPACE:   => 9a +š => š + +BOTTOM HALF INTEGRAL: ⌡ => 9b +› => › + +DEGREE SIGN: ° => 9c +œ => œ + +SUPERSCRIPT TWO: ² => 9d + =>  + +MIDDLE DOT: · => 9e +ž => ž + +DIVISION SIGN: ÷ => 9f +Ÿ => Ÿ + +BOX DRAWINGS DOUBLE HORIZONTAL: ═ => a0 +  => 9a + +BOX DRAWINGS DOUBLE VERTICAL: ║ => a1 +¡ => ¡ + +BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE: ╒ => a2 +¢ => ¢ + +CYRILLIC SMALL LETTER IO: ё => a3 +£ => £ + +BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE: ╓ => a4 +¤ => ¤ + +BOX DRAWINGS DOUBLE DOWN AND RIGHT: ╔ => a5 +¥ => ¥ + +BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE: ╕ => a6 +¦ => ¦ + +BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE: ╖ => a7 +§ => § + +BOX DRAWINGS DOUBLE DOWN AND LEFT: ╗ => a8 +¨ => ¨ + +BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE: ╘ => a9 +© => bf + +BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE: ╙ => aa +ª => ª + +BOX DRAWINGS DOUBLE UP AND RIGHT: ╚ => ab +« => « + +BOX DRAWINGS UP SINGLE AND LEFT DOUBLE: ╛ => ac +¬ => ¬ + +BOX DRAWINGS UP DOUBLE AND LEFT SINGLE: ╜ => ad +­ => ­ + +BOX DRAWINGS DOUBLE UP AND LEFT: ╝ => ae +® => ® + +BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE: ╞ => af +¯ => ¯ + +BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE: ╟ => b0 +° => 9c + +BOX DRAWINGS DOUBLE VERTICAL AND RIGHT: ╠ => b1 +± => ± + +BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE: ╡ => b2 +² => 9d + +CYRILLIC CAPITAL LETTER IO: Ё => b3 +³ => ³ + +BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE: ╢ => b4 +´ => ´ + +BOX DRAWINGS DOUBLE VERTICAL AND LEFT: ╣ => b5 +µ => µ + +BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE: ╤ => b6 +¶ => ¶ + +BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE: ╥ => b7 +· => 9e + +BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL: ╦ => b8 +¸ => ¸ + +BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE: ╧ => b9 +¹ => ¹ + +BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE: ╨ => ba +º => º + +BOX DRAWINGS DOUBLE UP AND HORIZONTAL: ╩ => bb +» => » + +BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE: ╪ => bc +¼ => ¼ + +BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE: ╫ => bd +½ => ½ + +BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: ╬ => be +¾ => ¾ + +COPYRIGHT SIGN: © => bf +¿ => ¿ + +CYRILLIC SMALL LETTER YU: ю => c0 +À => À + +CYRILLIC SMALL LETTER A: а => c1 +Á => Á + +CYRILLIC SMALL LETTER BE: б => c2 + =>  + +CYRILLIC SMALL LETTER TSE: ц => c3 +à => à + +CYRILLIC SMALL LETTER DE: д => c4 +Ä => Ä + +CYRILLIC SMALL LETTER IE: е => c5 +Å => Å + +CYRILLIC SMALL LETTER EF: ф => c6 +Æ => Æ + +CYRILLIC SMALL LETTER GHE: г => c7 +Ç => Ç + +CYRILLIC SMALL LETTER HA: х => c8 +È => È + +CYRILLIC SMALL LETTER I: и => c9 +É => É + +CYRILLIC SMALL LETTER SHORT I: й => ca +Ê => Ê + +CYRILLIC SMALL LETTER KA: к => cb +Ë => Ë + +CYRILLIC SMALL LETTER EL: л => cc +Ì => Ì + +CYRILLIC SMALL LETTER EM: м => cd +Í => Í + +CYRILLIC SMALL LETTER EN: н => ce +Î => Î + +CYRILLIC SMALL LETTER O: о => cf +Ï => Ï + +CYRILLIC SMALL LETTER PE: п => d0 +Ð => Ð + +CYRILLIC SMALL LETTER YA: я => d1 +Ñ => Ñ + +CYRILLIC SMALL LETTER ER: р => d2 +Ò => Ò + +CYRILLIC SMALL LETTER ES: с => d3 +Ó => Ó + +CYRILLIC SMALL LETTER TE: т => d4 +Ô => Ô + +CYRILLIC SMALL LETTER U: у => d5 +Õ => Õ + +CYRILLIC SMALL LETTER ZHE: ж => d6 +Ö => Ö + +CYRILLIC SMALL LETTER VE: в => d7 +× => × + +CYRILLIC SMALL LETTER SOFT SIGN: ь => d8 +Ø => Ø + +CYRILLIC SMALL LETTER YERU: ы => d9 +Ù => Ù + +CYRILLIC SMALL LETTER ZE: з => da +Ú => Ú + +CYRILLIC SMALL LETTER SHA: ш => db +Û => Û + +CYRILLIC SMALL LETTER E: э => dc +Ü => Ü + +CYRILLIC SMALL LETTER SHCHA: щ => dd +Ý => Ý + +CYRILLIC SMALL LETTER CHE: ч => de +Þ => Þ + +CYRILLIC SMALL LETTER HARD SIGN: ъ => df +ß => ß + +CYRILLIC CAPITAL LETTER YU: Ю => e0 +à => à + +CYRILLIC CAPITAL LETTER A: А => e1 +á => á + +CYRILLIC CAPITAL LETTER BE: Б => e2 +â => â + +CYRILLIC CAPITAL LETTER TSE: Ц => e3 +ã => ã + +CYRILLIC CAPITAL LETTER DE: Д => e4 +ä => ä + +CYRILLIC CAPITAL LETTER IE: Е => e5 +å => å + +CYRILLIC CAPITAL LETTER EF: Ф => e6 +æ => æ + +CYRILLIC CAPITAL LETTER GHE: Г => e7 +ç => ç + +CYRILLIC CAPITAL LETTER HA: Х => e8 +è => è + +CYRILLIC CAPITAL LETTER I: И => e9 +é => é + +CYRILLIC CAPITAL LETTER SHORT I: Й => ea +ê => ê + +CYRILLIC CAPITAL LETTER KA: К => eb +ë => ë + +CYRILLIC CAPITAL LETTER EL: Л => ec +ì => ì + +CYRILLIC CAPITAL LETTER EM: М => ed +í => í + +CYRILLIC CAPITAL LETTER EN: Н => ee +î => î + +CYRILLIC CAPITAL LETTER O: О => ef +ï => ï + +CYRILLIC CAPITAL LETTER PE: П => f0 +ð => ð + +CYRILLIC CAPITAL LETTER YA: Я => f1 +ñ => ñ + +CYRILLIC CAPITAL LETTER ER: Р => f2 +ò => ò + +CYRILLIC CAPITAL LETTER ES: С => f3 +ó => ó + +CYRILLIC CAPITAL LETTER TE: Т => f4 +ô => ô + +CYRILLIC CAPITAL LETTER U: У => f5 +õ => õ + +CYRILLIC CAPITAL LETTER ZHE: Ж => f6 +ö => ö + +CYRILLIC CAPITAL LETTER VE: В => f7 +÷ => 9f + +CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => f8 +ø => ø + +CYRILLIC CAPITAL LETTER YERU: Ы => f9 +ù => ù + +CYRILLIC CAPITAL LETTER ZE: З => fa +ú => ú + +CYRILLIC CAPITAL LETTER SHA: Ш => fb +û => û + +CYRILLIC CAPITAL LETTER E: Э => fc +ü => ü + +CYRILLIC CAPITAL LETTER SHCHA: Щ => fd +ý => ý + +CYRILLIC CAPITAL LETTER CHE: Ч => fe +þ => þ + +CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => ff +ÿ => ÿ diff --git a/tests/std/strings/html_entity_decode_macroman.phpt b/tests/std/strings/html_entity_decode_macroman.phpt new file mode 100644 index 00000000..6eb29188 --- /dev/null +++ b/tests/std/strings/html_entity_decode_macroman.phpt @@ -0,0 +1,539 @@ +--TEST-- +Translation of HTML entities for encoding MacRoman +--FILE-- + array(0x80, "LATIN CAPITAL LETTER A WITH DIAERESIS"), +0x00C5 => array(0x81, "LATIN CAPITAL LETTER A WITH RING ABOVE"), +0x00C7 => array(0x82, "LATIN CAPITAL LETTER C WITH CEDILLA"), +0x00C9 => array(0x83, "LATIN CAPITAL LETTER E WITH ACUTE"), +0x00D1 => array(0x84, "LATIN CAPITAL LETTER N WITH TILDE"), +0x00D6 => array(0x85, "LATIN CAPITAL LETTER O WITH DIAERESIS"), +0x00DC => array(0x86, "LATIN CAPITAL LETTER U WITH DIAERESIS"), +0x00E1 => array(0x87, "LATIN SMALL LETTER A WITH ACUTE"), +0x00E0 => array(0x88, "LATIN SMALL LETTER A WITH GRAVE"), +0x00E2 => array(0x89, "LATIN SMALL LETTER A WITH CIRCUMFLEX"), +0x00E4 => array(0x8A, "LATIN SMALL LETTER A WITH DIAERESIS"), +0x00E3 => array(0x8B, "LATIN SMALL LETTER A WITH TILDE"), +0x00E5 => array(0x8C, "LATIN SMALL LETTER A WITH RING ABOVE"), +0x00E7 => array(0x8D, "LATIN SMALL LETTER C WITH CEDILLA"), +0x00E9 => array(0x8E, "LATIN SMALL LETTER E WITH ACUTE"), +0x00E8 => array(0x8F, "LATIN SMALL LETTER E WITH GRAVE"), +0x00EA => array(0x90, "LATIN SMALL LETTER E WITH CIRCUMFLEX"), +0x00EB => array(0x91, "LATIN SMALL LETTER E WITH DIAERESIS"), +0x00ED => array(0x92, "LATIN SMALL LETTER I WITH ACUTE"), +0x00EC => array(0x93, "LATIN SMALL LETTER I WITH GRAVE"), +0x00EE => array(0x94, "LATIN SMALL LETTER I WITH CIRCUMFLEX"), +0x00EF => array(0x95, "LATIN SMALL LETTER I WITH DIAERESIS"), +0x00F1 => array(0x96, "LATIN SMALL LETTER N WITH TILDE"), +0x00F3 => array(0x97, "LATIN SMALL LETTER O WITH ACUTE"), +0x00F2 => array(0x98, "LATIN SMALL LETTER O WITH GRAVE"), +0x00F4 => array(0x99, "LATIN SMALL LETTER O WITH CIRCUMFLEX"), +0x00F6 => array(0x9A, "LATIN SMALL LETTER O WITH DIAERESIS"), +0x00F5 => array(0x9B, "LATIN SMALL LETTER O WITH TILDE"), +0x00FA => array(0x9C, "LATIN SMALL LETTER U WITH ACUTE"), +0x00F9 => array(0x9D, "LATIN SMALL LETTER U WITH GRAVE"), +0x00FB => array(0x9E, "LATIN SMALL LETTER U WITH CIRCUMFLEX"), +0x00FC => array(0x9F, "LATIN SMALL LETTER U WITH DIAERESIS"), +0x2020 => array(0xA0, "DAGGER"), +0x00B0 => array(0xA1, "DEGREE SIGN"), +0x00A2 => array(0xA2, "CENT SIGN"), +0x00A3 => array(0xA3, "POUND SIGN"), +0x00A7 => array(0xA4, "SECTION SIGN"), +0x2022 => array(0xA5, "BULLET"), +0x00B6 => array(0xA6, "PILCROW SIGN"), +0x00DF => array(0xA7, "LATIN SMALL LETTER SHARP S"), +0x00AE => array(0xA8, "REGISTERED SIGN"), +0x00A9 => array(0xA9, "COPYRIGHT SIGN"), +0x2122 => array(0xAA, "TRADE MARK SIGN"), +0x00B4 => array(0xAB, "ACUTE ACCENT"), +0x00A8 => array(0xAC, "DIAERESIS"), +0x2260 => array(0xAD, "NOT EQUAL TO"), +0x00C6 => array(0xAE, "LATIN CAPITAL LETTER AE"), +0x00D8 => array(0xAF, "LATIN CAPITAL LETTER O WITH STROKE"), +0x221E => array(0xB0, "INFINITY"), +0x00B1 => array(0xB1, "PLUS-MINUS SIGN"), +0x2264 => array(0xB2, "LESS-THAN OR EQUAL TO"), +0x2265 => array(0xB3, "GREATER-THAN OR EQUAL TO"), +0x00A5 => array(0xB4, "YEN SIGN"), +0x00B5 => array(0xB5, "MICRO SIGN"), +0x2202 => array(0xB6, "PARTIAL DIFFERENTIAL"), +0x2211 => array(0xB7, "N-ARY SUMMATION"), +0x220F => array(0xB8, "N-ARY PRODUCT"), +0x03C0 => array(0xB9, "GREEK SMALL LETTER PI"), +0x222B => array(0xBA, "INTEGRAL"), +0x00AA => array(0xBB, "FEMININE ORDINAL INDICATOR"), +0x00BA => array(0xBC, "MASCULINE ORDINAL INDICATOR"), +0x03A9 => array(0xBD, "GREEK CAPITAL LETTER OMEGA"), +0x00E6 => array(0xBE, "LATIN SMALL LETTER AE"), +0x00F8 => array(0xBF, "LATIN SMALL LETTER O WITH STROKE"), +0x00BF => array(0xC0, "INVERTED QUESTION MARK"), +0x00A1 => array(0xC1, "INVERTED EXCLAMATION MARK"), +0x00AC => array(0xC2, "NOT SIGN"), +0x221A => array(0xC3, "SQUARE ROOT"), +0x0192 => array(0xC4, "LATIN SMALL LETTER F WITH HOOK"), +0x2248 => array(0xC5, "ALMOST EQUAL TO"), +0x2206 => array(0xC6, "INCREMENT"), +0x00AB => array(0xC7, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x00BB => array(0xC8, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x2026 => array(0xC9, "HORIZONTAL ELLIPSIS"), +0x00A0 => array(0xCA, "NO-BREAK SPACE"), +0x00C0 => array(0xCB, "LATIN CAPITAL LETTER A WITH GRAVE"), +0x00C3 => array(0xCC, "LATIN CAPITAL LETTER A WITH TILDE"), +0x00D5 => array(0xCD, "LATIN CAPITAL LETTER O WITH TILDE"), +0x0152 => array(0xCE, "LATIN CAPITAL LIGATURE OE"), +0x0153 => array(0xCF, "LATIN SMALL LIGATURE OE"), +0x2013 => array(0xD0, "EN DASH"), +0x2014 => array(0xD1, "EM DASH"), +0x201C => array(0xD2, "LEFT DOUBLE QUOTATION MARK"), +0x201D => array(0xD3, "RIGHT DOUBLE QUOTATION MARK"), +0x2018 => array(0xD4, "LEFT SINGLE QUOTATION MARK"), +0x2019 => array(0xD5, "RIGHT SINGLE QUOTATION MARK"), +0x00F7 => array(0xD6, "DIVISION SIGN"), +0x25CA => array(0xD7, "LOZENGE"), +0x00FF => array(0xD8, "LATIN SMALL LETTER Y WITH DIAERESIS"), +0x0178 => array(0xD9, "LATIN CAPITAL LETTER Y WITH DIAERESIS"), +0x2044 => array(0xDA, "FRACTION SLASH"), +0x20AC => array(0xDB, "EURO SIGN"), +0x2039 => array(0xDC, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"), +0x203A => array(0xDD, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"), +0xFB01 => array(0xDE, "LATIN SMALL LIGATURE FI"), +0xFB02 => array(0xDF, "LATIN SMALL LIGATURE FL"), +0x2021 => array(0xE0, "DOUBLE DAGGER"), +0x00B7 => array(0xE1, "MIDDLE DOT"), +0x201A => array(0xE2, "SINGLE LOW-9 QUOTATION MARK"), +0x201E => array(0xE3, "DOUBLE LOW-9 QUOTATION MARK"), +0x2030 => array(0xE4, "PER MILLE SIGN"), +0x00C2 => array(0xE5, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"), +0x00CA => array(0xE6, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"), +0x00C1 => array(0xE7, "LATIN CAPITAL LETTER A WITH ACUTE"), +0x00CB => array(0xE8, "LATIN CAPITAL LETTER E WITH DIAERESIS"), +0x00C8 => array(0xE9, "LATIN CAPITAL LETTER E WITH GRAVE"), +0x00CD => array(0xEA, "LATIN CAPITAL LETTER I WITH ACUTE"), +0x00CE => array(0xEB, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"), +0x00CF => array(0xEC, "LATIN CAPITAL LETTER I WITH DIAERESIS"), +0x00CC => array(0xED, "LATIN CAPITAL LETTER I WITH GRAVE"), +0x00D3 => array(0xEE, "LATIN CAPITAL LETTER O WITH ACUTE"), +0x00D4 => array(0xEF, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"), +0xF8FF => array(0xF0, "Apple logo"), +0x00D2 => array(0xF1, "LATIN CAPITAL LETTER O WITH GRAVE"), +0x00DA => array(0xF2, "LATIN CAPITAL LETTER U WITH ACUTE"), +0x00DB => array(0xF3, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"), +0x00D9 => array(0xF4, "LATIN CAPITAL LETTER U WITH GRAVE"), +0x0131 => array(0xF5, "LATIN SMALL LETTER DOTLESS I"), +0x02C6 => array(0xF6, "MODIFIER LETTER CIRCUMFLEX ACCENT"), +0x02DC => array(0xF7, "SMALL TILDE"), +0x00AF => array(0xF8, "MACRON"), +0x02D8 => array(0xF9, "BREVE"), +0x02D9 => array(0xFA, "DOT ABOVE"), +0x02DA => array(0xFB, "RING ABOVE"), +0x00B8 => array(0xFC, "CEDILLA"), +0x02DD => array(0xFD, "DOUBLE ACUTE ACCENT"), +0x02DB => array(0xFE, "OGONEK"), +0x02C7 => array(0xFF, "CARON"), +); + +$res = html_entity_decode("", ENT_QUOTES, 'MacRoman'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +Special test for  (shouldn't decode): + + +LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => 80 +€ => € + +LATIN CAPITAL LETTER A WITH RING ABOVE: Å => 81 + =>  + +LATIN CAPITAL LETTER C WITH CEDILLA: Ç => 82 +‚ => ‚ + +LATIN CAPITAL LETTER E WITH ACUTE: É => 83 +ƒ => ƒ + +LATIN CAPITAL LETTER N WITH TILDE: Ñ => 84 +„ => „ + +LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => 85 +… => … + +LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => 86 +† => † + +LATIN SMALL LETTER A WITH ACUTE: á => 87 +‡ => ‡ + +LATIN SMALL LETTER A WITH GRAVE: à => 88 +ˆ => ˆ + +LATIN SMALL LETTER A WITH CIRCUMFLEX: â => 89 +‰ => ‰ + +LATIN SMALL LETTER A WITH DIAERESIS: ä => 8a +Š => Š + +LATIN SMALL LETTER A WITH TILDE: ã => 8b +‹ => ‹ + +LATIN SMALL LETTER A WITH RING ABOVE: å => 8c +Œ => Œ + +LATIN SMALL LETTER C WITH CEDILLA: ç => 8d + =>  + +LATIN SMALL LETTER E WITH ACUTE: é => 8e +Ž => Ž + +LATIN SMALL LETTER E WITH GRAVE: è => 8f + =>  + +LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => 90 + =>  + +LATIN SMALL LETTER E WITH DIAERESIS: ë => 91 +‘ => ‘ + +LATIN SMALL LETTER I WITH ACUTE: í => 92 +’ => ’ + +LATIN SMALL LETTER I WITH GRAVE: ì => 93 +“ => “ + +LATIN SMALL LETTER I WITH CIRCUMFLEX: î => 94 +” => ” + +LATIN SMALL LETTER I WITH DIAERESIS: ï => 95 +• => • + +LATIN SMALL LETTER N WITH TILDE: ñ => 96 +– => – + +LATIN SMALL LETTER O WITH ACUTE: ó => 97 +— => — + +LATIN SMALL LETTER O WITH GRAVE: ò => 98 +˜ => ˜ + +LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => 99 +™ => ™ + +LATIN SMALL LETTER O WITH DIAERESIS: ö => 9a +š => š + +LATIN SMALL LETTER O WITH TILDE: õ => 9b +› => › + +LATIN SMALL LETTER U WITH ACUTE: ú => 9c +œ => œ + +LATIN SMALL LETTER U WITH GRAVE: ù => 9d + =>  + +LATIN SMALL LETTER U WITH CIRCUMFLEX: û => 9e +ž => ž + +LATIN SMALL LETTER U WITH DIAERESIS: ü => 9f +Ÿ => Ÿ + +DAGGER: † => a0 +  => ca + +DEGREE SIGN: ° => a1 +¡ => c1 + +CENT SIGN: ¢ => a2 +¢ => a2 + +POUND SIGN: £ => a3 +£ => a3 + +SECTION SIGN: § => a4 +¤ => ¤ + +BULLET: • => a5 +¥ => b4 + +PILCROW SIGN: ¶ => a6 +¦ => ¦ + +LATIN SMALL LETTER SHARP S: ß => a7 +§ => a4 + +REGISTERED SIGN: ® => a8 +¨ => ac + +COPYRIGHT SIGN: © => a9 +© => a9 + +TRADE MARK SIGN: ™ => aa +ª => bb + +ACUTE ACCENT: ´ => ab +« => c7 + +DIAERESIS: ¨ => ac +¬ => c2 + +NOT EQUAL TO: ≠ => ad +­ => ­ + +LATIN CAPITAL LETTER AE: Æ => ae +® => a8 + +LATIN CAPITAL LETTER O WITH STROKE: Ø => af +¯ => f8 + +INFINITY: ∞ => b0 +° => a1 + +PLUS-MINUS SIGN: ± => b1 +± => b1 + +LESS-THAN OR EQUAL TO: ≤ => b2 +² => ² + +GREATER-THAN OR EQUAL TO: ≥ => b3 +³ => ³ + +YEN SIGN: ¥ => b4 +´ => ab + +MICRO SIGN: µ => b5 +µ => b5 + +PARTIAL DIFFERENTIAL: ∂ => b6 +¶ => a6 + +N-ARY SUMMATION: ∑ => b7 +· => e1 + +N-ARY PRODUCT: ∏ => b8 +¸ => fc + +GREEK SMALL LETTER PI: π => b9 +¹ => ¹ + +INTEGRAL: ∫ => ba +º => bc + +FEMININE ORDINAL INDICATOR: ª => bb +» => c8 + +MASCULINE ORDINAL INDICATOR: º => bc +¼ => ¼ + +GREEK CAPITAL LETTER OMEGA: Ω => bd +½ => ½ + +LATIN SMALL LETTER AE: æ => be +¾ => ¾ + +LATIN SMALL LETTER O WITH STROKE: ø => bf +¿ => c0 + +INVERTED QUESTION MARK: ¿ => c0 +À => cb + +INVERTED EXCLAMATION MARK: ¡ => c1 +Á => e7 + +NOT SIGN: ¬ => c2 + => e5 + +SQUARE ROOT: √ => c3 +à => cc + +LATIN SMALL LETTER F WITH HOOK: ƒ => c4 +Ä => 80 + +ALMOST EQUAL TO: ≈ => c5 +Å => 81 + +INCREMENT: ∆ => c6 +Æ => ae + +LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => c7 +Ç => 82 + +RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => c8 +È => e9 + +HORIZONTAL ELLIPSIS: … => c9 +É => 83 + +NO-BREAK SPACE:   => ca +Ê => e6 + +LATIN CAPITAL LETTER A WITH GRAVE: À => cb +Ë => e8 + +LATIN CAPITAL LETTER A WITH TILDE: à => cc +Ì => ed + +LATIN CAPITAL LETTER O WITH TILDE: Õ => cd +Í => ea + +LATIN CAPITAL LIGATURE OE: Œ => ce +Î => eb + +LATIN SMALL LIGATURE OE: œ => cf +Ï => ec + +EN DASH: – => d0 +Ð => Ð + +EM DASH: — => d1 +Ñ => 84 + +LEFT DOUBLE QUOTATION MARK: “ => d2 +Ò => f1 + +RIGHT DOUBLE QUOTATION MARK: ” => d3 +Ó => ee + +LEFT SINGLE QUOTATION MARK: ‘ => d4 +Ô => ef + +RIGHT SINGLE QUOTATION MARK: ’ => d5 +Õ => cd + +DIVISION SIGN: ÷ => d6 +Ö => 85 + +LOZENGE: ◊ => d7 +× => × + +LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => d8 +Ø => af + +LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => d9 +Ù => f4 + +FRACTION SLASH: ⁄ => da +Ú => f2 + +EURO SIGN: € => db +Û => f3 + +SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => dc +Ü => 86 + +SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => dd +Ý => Ý + +LATIN SMALL LIGATURE FI: fi => de +Þ => Þ + +LATIN SMALL LIGATURE FL: fl => df +ß => a7 + +DOUBLE DAGGER: ‡ => e0 +à => 88 + +MIDDLE DOT: · => e1 +á => 87 + +SINGLE LOW-9 QUOTATION MARK: ‚ => e2 +â => 89 + +DOUBLE LOW-9 QUOTATION MARK: „ => e3 +ã => 8b + +PER MILLE SIGN: ‰ => e4 +ä => 8a + +LATIN CAPITAL LETTER A WITH CIRCUMFLEX:  => e5 +å => 8c + +LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => e6 +æ => be + +LATIN CAPITAL LETTER A WITH ACUTE: Á => e7 +ç => 8d + +LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => e8 +è => 8f + +LATIN CAPITAL LETTER E WITH GRAVE: È => e9 +é => 8e + +LATIN CAPITAL LETTER I WITH ACUTE: Í => ea +ê => 90 + +LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => eb +ë => 91 + +LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => ec +ì => 93 + +LATIN CAPITAL LETTER I WITH GRAVE: Ì => ed +í => 92 + +LATIN CAPITAL LETTER O WITH ACUTE: Ó => ee +î => 94 + +LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => ef +ï => 95 + +Apple logo:  => f0 +ð => ð + +LATIN CAPITAL LETTER O WITH GRAVE: Ò => f1 +ñ => 96 + +LATIN CAPITAL LETTER U WITH ACUTE: Ú => f2 +ò => 98 + +LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => f3 +ó => 97 + +LATIN CAPITAL LETTER U WITH GRAVE: Ù => f4 +ô => 99 + +LATIN SMALL LETTER DOTLESS I: ı => f5 +õ => 9b + +MODIFIER LETTER CIRCUMFLEX ACCENT: ˆ => f6 +ö => 9a + +SMALL TILDE: ˜ => f7 +÷ => d6 + +MACRON: ¯ => f8 +ø => bf + +BREVE: ˘ => f9 +ù => 9d + +DOT ABOVE: ˙ => fa +ú => 9c + +RING ABOVE: ˚ => fb +û => 9e + +CEDILLA: ¸ => fc +ü => 9f + +DOUBLE ACUTE ACCENT: ˝ => fd +ý => ý + +OGONEK: ˛ => fe +þ => þ + +CARON: ˇ => ff +ÿ => d8 diff --git a/tests/std/strings/html_entity_decode_win1251.phpt b/tests/std/strings/html_entity_decode_win1251.phpt new file mode 100644 index 00000000..8a9b3dde --- /dev/null +++ b/tests/std/strings/html_entity_decode_win1251.phpt @@ -0,0 +1,536 @@ +--TEST-- +Translation of HTML entities for encoding WIN-1251 +--FILE-- + array(0x80, "CYRILLIC CAPITAL LETTER DJE"), +0x0403 => array(0x81, "CYRILLIC CAPITAL LETTER GJE"), +0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"), +0x0453 => array(0x83, "CYRILLIC SMALL LETTER GJE"), +0x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"), +0x2026 => array(0x85, "HORIZONTAL ELLIPSIS"), +0x2020 => array(0x86, "DAGGER"), +0x2021 => array(0x87, "DOUBLE DAGGER"), +0x20AC => array(0x88, "EURO SIGN"), +0x2030 => array(0x89, "PER MILLE SIGN"), +0x0409 => array(0x8A, "CYRILLIC CAPITAL LETTER LJE"), +0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"), +0x040A => array(0x8C, "CYRILLIC CAPITAL LETTER NJE"), +0x040C => array(0x8D, "CYRILLIC CAPITAL LETTER KJE"), +0x040B => array(0x8E, "CYRILLIC CAPITAL LETTER TSHE"), +0x040F => array(0x8F, "CYRILLIC CAPITAL LETTER DZHE"), +0x0452 => array(0x90, "CYRILLIC SMALL LETTER DJE"), +0x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"), +0x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"), +0x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"), +0x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"), +0x2022 => array(0x95, "BULLET"), +0x2013 => array(0x96, "EN DASH"), +0x2014 => array(0x97, "EM DASH"), +//0x98 #UNDEFINED +0x2122 => array(0x99, "TRADE MARK SIGN"), +0x0459 => array(0x9A, "CYRILLIC SMALL LETTER LJE"), +0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"), +0x045A => array(0x9C, "CYRILLIC SMALL LETTER NJE"), +0x045C => array(0x9D, "CYRILLIC SMALL LETTER KJE"), +0x045B => array(0x9E, "CYRILLIC SMALL LETTER TSHE"), +0x045F => array(0x9F, "CYRILLIC SMALL LETTER DZHE"), +0x00A0 => array(0xA0, "NO-BREAK SPACE"), +0x040E => array(0xA1, "CYRILLIC CAPITAL LETTER SHORT U"), +0x045E => array(0xA2, "CYRILLIC SMALL LETTER SHORT U"), +0x0408 => array(0xA3, "CYRILLIC CAPITAL LETTER JE"), +0x00A4 => array(0xA4, "CURRENCY SIGN"), +0x0490 => array(0xA5, "CYRILLIC CAPITAL LETTER GHE WITH UPTURN"), +0x00A6 => array(0xA6, "BROKEN BAR"), +0x00A7 => array(0xA7, "SECTION SIGN"), +0x0401 => array(0xA8, "CYRILLIC CAPITAL LETTER IO"), +0x00A9 => array(0xA9, "COPYRIGHT SIGN"), +0x0404 => array(0xAA, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"), +0x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x00AC => array(0xAC, "NOT SIGN"), +0x00AD => array(0xAD, "SOFT HYPHEN"), +0x00AE => array(0xAE, "REGISTERED SIGN"), +0x0407 => array(0xAF, "CYRILLIC CAPITAL LETTER YI"), +0x00B0 => array(0xB0, "DEGREE SIGN"), +0x00B1 => array(0xB1, "PLUS-MINUS SIGN"), +0x0406 => array(0xB2, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"), +0x0456 => array(0xB3, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"), +0x0491 => array(0xB4, "CYRILLIC SMALL LETTER GHE WITH UPTURN"), +0x00B5 => array(0xB5, "MICRO SIGN"), +0x00B6 => array(0xB6, "PILCROW SIGN"), +0x00B7 => array(0xB7, "MIDDLE DOT"), +0x0451 => array(0xB8, "CYRILLIC SMALL LETTER IO"), +0x2116 => array(0xB9, "NUMERO SIGN"), +0x0454 => array(0xBA, "CYRILLIC SMALL LETTER UKRAINIAN IE"), +0x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"), +0x0458 => array(0xBC, "CYRILLIC SMALL LETTER JE"), +0x0405 => array(0xBD, "CYRILLIC CAPITAL LETTER DZE"), +0x0455 => array(0xBE, "CYRILLIC SMALL LETTER DZE"), +0x0457 => array(0xBF, "CYRILLIC SMALL LETTER YI"), +0x0410 => array(0xC0, "CYRILLIC CAPITAL LETTER A"), +0x0411 => array(0xC1, "CYRILLIC CAPITAL LETTER BE"), +0x0412 => array(0xC2, "CYRILLIC CAPITAL LETTER VE"), +0x0413 => array(0xC3, "CYRILLIC CAPITAL LETTER GHE"), +0x0414 => array(0xC4, "CYRILLIC CAPITAL LETTER DE"), +0x0415 => array(0xC5, "CYRILLIC CAPITAL LETTER IE"), +0x0416 => array(0xC6, "CYRILLIC CAPITAL LETTER ZHE"), +0x0417 => array(0xC7, "CYRILLIC CAPITAL LETTER ZE"), +0x0418 => array(0xC8, "CYRILLIC CAPITAL LETTER I"), +0x0419 => array(0xC9, "CYRILLIC CAPITAL LETTER SHORT I"), +0x041A => array(0xCA, "CYRILLIC CAPITAL LETTER KA"), +0x041B => array(0xCB, "CYRILLIC CAPITAL LETTER EL"), +0x041C => array(0xCC, "CYRILLIC CAPITAL LETTER EM"), +0x041D => array(0xCD, "CYRILLIC CAPITAL LETTER EN"), +0x041E => array(0xCE, "CYRILLIC CAPITAL LETTER O"), +0x041F => array(0xCF, "CYRILLIC CAPITAL LETTER PE"), +0x0420 => array(0xD0, "CYRILLIC CAPITAL LETTER ER"), +0x0421 => array(0xD1, "CYRILLIC CAPITAL LETTER ES"), +0x0422 => array(0xD2, "CYRILLIC CAPITAL LETTER TE"), +0x0423 => array(0xD3, "CYRILLIC CAPITAL LETTER U"), +0x0424 => array(0xD4, "CYRILLIC CAPITAL LETTER EF"), +0x0425 => array(0xD5, "CYRILLIC CAPITAL LETTER HA"), +0x0426 => array(0xD6, "CYRILLIC CAPITAL LETTER TSE"), +0x0427 => array(0xD7, "CYRILLIC CAPITAL LETTER CHE"), +0x0428 => array(0xD8, "CYRILLIC CAPITAL LETTER SHA"), +0x0429 => array(0xD9, "CYRILLIC CAPITAL LETTER SHCHA"), +0x042A => array(0xDA, "CYRILLIC CAPITAL LETTER HARD SIGN"), +0x042B => array(0xDB, "CYRILLIC CAPITAL LETTER YERU"), +0x042C => array(0xDC, "CYRILLIC CAPITAL LETTER SOFT SIGN"), +0x042D => array(0xDD, "CYRILLIC CAPITAL LETTER E"), +0x042E => array(0xDE, "CYRILLIC CAPITAL LETTER YU"), +0x042F => array(0xDF, "CYRILLIC CAPITAL LETTER YA"), +0x0430 => array(0xE0, "CYRILLIC SMALL LETTER A"), +0x0431 => array(0xE1, "CYRILLIC SMALL LETTER BE"), +0x0432 => array(0xE2, "CYRILLIC SMALL LETTER VE"), +0x0433 => array(0xE3, "CYRILLIC SMALL LETTER GHE"), +0x0434 => array(0xE4, "CYRILLIC SMALL LETTER DE"), +0x0435 => array(0xE5, "CYRILLIC SMALL LETTER IE"), +0x0436 => array(0xE6, "CYRILLIC SMALL LETTER ZHE"), +0x0437 => array(0xE7, "CYRILLIC SMALL LETTER ZE"), +0x0438 => array(0xE8, "CYRILLIC SMALL LETTER I"), +0x0439 => array(0xE9, "CYRILLIC SMALL LETTER SHORT I"), +0x043A => array(0xEA, "CYRILLIC SMALL LETTER KA"), +0x043B => array(0xEB, "CYRILLIC SMALL LETTER EL"), +0x043C => array(0xEC, "CYRILLIC SMALL LETTER EM"), +0x043D => array(0xED, "CYRILLIC SMALL LETTER EN"), +0x043E => array(0xEE, "CYRILLIC SMALL LETTER O"), +0x043F => array(0xEF, "CYRILLIC SMALL LETTER PE"), +0x0440 => array(0xF0, "CYRILLIC SMALL LETTER ER"), +0x0441 => array(0xF1, "CYRILLIC SMALL LETTER ES"), +0x0442 => array(0xF2, "CYRILLIC SMALL LETTER TE"), +0x0443 => array(0xF3, "CYRILLIC SMALL LETTER U"), +0x0444 => array(0xF4, "CYRILLIC SMALL LETTER EF"), +0x0445 => array(0xF5, "CYRILLIC SMALL LETTER HA"), +0x0446 => array(0xF6, "CYRILLIC SMALL LETTER TSE"), +0x0447 => array(0xF7, "CYRILLIC SMALL LETTER CHE"), +0x0448 => array(0xF8, "CYRILLIC SMALL LETTER SHA"), +0x0449 => array(0xF9, "CYRILLIC SMALL LETTER SHCHA"), +0x044A => array(0xFA, "CYRILLIC SMALL LETTER HARD SIGN"), +0x044B => array(0xFB, "CYRILLIC SMALL LETTER YERU"), +0x044C => array(0xFC, "CYRILLIC SMALL LETTER SOFT SIGN"), +0x044D => array(0xFD, "CYRILLIC SMALL LETTER E"), +0x044E => array(0xFE, "CYRILLIC SMALL LETTER YU"), +0x044F => array(0xFF, "CYRILLIC SMALL LETTER YA"), +); + +$res = html_entity_decode("˜", ENT_QUOTES, 'WINDOWS-1251'); +echo "Special test for ˜ (shouldn't decode):\n"; +echo $res,"\n\n"; + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +Special test for ˜ (shouldn't decode): +˜ + +CYRILLIC CAPITAL LETTER DJE: Ђ => 80 +€ => € + +CYRILLIC CAPITAL LETTER GJE: Ѓ => 81 + =>  + +SINGLE LOW-9 QUOTATION MARK: ‚ => 82 +‚ => ‚ + +CYRILLIC SMALL LETTER GJE: ѓ => 83 +ƒ => ƒ + +DOUBLE LOW-9 QUOTATION MARK: „ => 84 +„ => „ + +HORIZONTAL ELLIPSIS: … => 85 +… => … + +DAGGER: † => 86 +† => † + +DOUBLE DAGGER: ‡ => 87 +‡ => ‡ + +EURO SIGN: € => 88 +ˆ => ˆ + +PER MILLE SIGN: ‰ => 89 +‰ => ‰ + +CYRILLIC CAPITAL LETTER LJE: Љ => 8a +Š => Š + +SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => 8b +‹ => ‹ + +CYRILLIC CAPITAL LETTER NJE: Њ => 8c +Œ => Œ + +CYRILLIC CAPITAL LETTER KJE: Ќ => 8d + =>  + +CYRILLIC CAPITAL LETTER TSHE: Ћ => 8e +Ž => Ž + +CYRILLIC CAPITAL LETTER DZHE: Џ => 8f + =>  + +CYRILLIC SMALL LETTER DJE: ђ => 90 + =>  + +LEFT SINGLE QUOTATION MARK: ‘ => 91 +‘ => ‘ + +RIGHT SINGLE QUOTATION MARK: ’ => 92 +’ => ’ + +LEFT DOUBLE QUOTATION MARK: “ => 93 +“ => “ + +RIGHT DOUBLE QUOTATION MARK: ” => 94 +” => ” + +BULLET: • => 95 +• => • + +EN DASH: – => 96 +– => – + +EM DASH: — => 97 +— => — + +TRADE MARK SIGN: ™ => 99 +™ => ™ + +CYRILLIC SMALL LETTER LJE: љ => 9a +š => š + +SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => 9b +› => › + +CYRILLIC SMALL LETTER NJE: њ => 9c +œ => œ + +CYRILLIC SMALL LETTER KJE: ќ => 9d + =>  + +CYRILLIC SMALL LETTER TSHE: ћ => 9e +ž => ž + +CYRILLIC SMALL LETTER DZHE: џ => 9f +Ÿ => Ÿ + +NO-BREAK SPACE:   => a0 +  => a0 + +CYRILLIC CAPITAL LETTER SHORT U: Ў => a1 +¡ => ¡ + +CYRILLIC SMALL LETTER SHORT U: ў => a2 +¢ => ¢ + +CYRILLIC CAPITAL LETTER JE: Ј => a3 +£ => £ + +CURRENCY SIGN: ¤ => a4 +¤ => a4 + +CYRILLIC CAPITAL LETTER GHE WITH UPTURN: Ґ => a5 +¥ => ¥ + +BROKEN BAR: ¦ => a6 +¦ => a6 + +SECTION SIGN: § => a7 +§ => a7 + +CYRILLIC CAPITAL LETTER IO: Ё => a8 +¨ => ¨ + +COPYRIGHT SIGN: © => a9 +© => a9 + +CYRILLIC CAPITAL LETTER UKRAINIAN IE: Є => aa +ª => ª + +LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => ab +« => ab + +NOT SIGN: ¬ => ac +¬ => ac + +SOFT HYPHEN: ­ => ad +­ => ad + +REGISTERED SIGN: ® => ae +® => ae + +CYRILLIC CAPITAL LETTER YI: Ї => af +¯ => ¯ + +DEGREE SIGN: ° => b0 +° => b0 + +PLUS-MINUS SIGN: ± => b1 +± => b1 + +CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: І => b2 +² => ² + +CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: і => b3 +³ => ³ + +CYRILLIC SMALL LETTER GHE WITH UPTURN: ґ => b4 +´ => ´ + +MICRO SIGN: µ => b5 +µ => b5 + +PILCROW SIGN: ¶ => b6 +¶ => b6 + +MIDDLE DOT: · => b7 +· => b7 + +CYRILLIC SMALL LETTER IO: ё => b8 +¸ => ¸ + +NUMERO SIGN: № => b9 +¹ => ¹ + +CYRILLIC SMALL LETTER UKRAINIAN IE: є => ba +º => º + +RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => bb +» => bb + +CYRILLIC SMALL LETTER JE: ј => bc +¼ => ¼ + +CYRILLIC CAPITAL LETTER DZE: Ѕ => bd +½ => ½ + +CYRILLIC SMALL LETTER DZE: ѕ => be +¾ => ¾ + +CYRILLIC SMALL LETTER YI: ї => bf +¿ => ¿ + +CYRILLIC CAPITAL LETTER A: А => c0 +À => À + +CYRILLIC CAPITAL LETTER BE: Б => c1 +Á => Á + +CYRILLIC CAPITAL LETTER VE: В => c2 + =>  + +CYRILLIC CAPITAL LETTER GHE: Г => c3 +à => à + +CYRILLIC CAPITAL LETTER DE: Д => c4 +Ä => Ä + +CYRILLIC CAPITAL LETTER IE: Е => c5 +Å => Å + +CYRILLIC CAPITAL LETTER ZHE: Ж => c6 +Æ => Æ + +CYRILLIC CAPITAL LETTER ZE: З => c7 +Ç => Ç + +CYRILLIC CAPITAL LETTER I: И => c8 +È => È + +CYRILLIC CAPITAL LETTER SHORT I: Й => c9 +É => É + +CYRILLIC CAPITAL LETTER KA: К => ca +Ê => Ê + +CYRILLIC CAPITAL LETTER EL: Л => cb +Ë => Ë + +CYRILLIC CAPITAL LETTER EM: М => cc +Ì => Ì + +CYRILLIC CAPITAL LETTER EN: Н => cd +Í => Í + +CYRILLIC CAPITAL LETTER O: О => ce +Î => Î + +CYRILLIC CAPITAL LETTER PE: П => cf +Ï => Ï + +CYRILLIC CAPITAL LETTER ER: Р => d0 +Ð => Ð + +CYRILLIC CAPITAL LETTER ES: С => d1 +Ñ => Ñ + +CYRILLIC CAPITAL LETTER TE: Т => d2 +Ò => Ò + +CYRILLIC CAPITAL LETTER U: У => d3 +Ó => Ó + +CYRILLIC CAPITAL LETTER EF: Ф => d4 +Ô => Ô + +CYRILLIC CAPITAL LETTER HA: Х => d5 +Õ => Õ + +CYRILLIC CAPITAL LETTER TSE: Ц => d6 +Ö => Ö + +CYRILLIC CAPITAL LETTER CHE: Ч => d7 +× => × + +CYRILLIC CAPITAL LETTER SHA: Ш => d8 +Ø => Ø + +CYRILLIC CAPITAL LETTER SHCHA: Щ => d9 +Ù => Ù + +CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => da +Ú => Ú + +CYRILLIC CAPITAL LETTER YERU: Ы => db +Û => Û + +CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => dc +Ü => Ü + +CYRILLIC CAPITAL LETTER E: Э => dd +Ý => Ý + +CYRILLIC CAPITAL LETTER YU: Ю => de +Þ => Þ + +CYRILLIC CAPITAL LETTER YA: Я => df +ß => ß + +CYRILLIC SMALL LETTER A: а => e0 +à => à + +CYRILLIC SMALL LETTER BE: б => e1 +á => á + +CYRILLIC SMALL LETTER VE: в => e2 +â => â + +CYRILLIC SMALL LETTER GHE: г => e3 +ã => ã + +CYRILLIC SMALL LETTER DE: д => e4 +ä => ä + +CYRILLIC SMALL LETTER IE: е => e5 +å => å + +CYRILLIC SMALL LETTER ZHE: ж => e6 +æ => æ + +CYRILLIC SMALL LETTER ZE: з => e7 +ç => ç + +CYRILLIC SMALL LETTER I: и => e8 +è => è + +CYRILLIC SMALL LETTER SHORT I: й => e9 +é => é + +CYRILLIC SMALL LETTER KA: к => ea +ê => ê + +CYRILLIC SMALL LETTER EL: л => eb +ë => ë + +CYRILLIC SMALL LETTER EM: м => ec +ì => ì + +CYRILLIC SMALL LETTER EN: н => ed +í => í + +CYRILLIC SMALL LETTER O: о => ee +î => î + +CYRILLIC SMALL LETTER PE: п => ef +ï => ï + +CYRILLIC SMALL LETTER ER: р => f0 +ð => ð + +CYRILLIC SMALL LETTER ES: с => f1 +ñ => ñ + +CYRILLIC SMALL LETTER TE: т => f2 +ò => ò + +CYRILLIC SMALL LETTER U: у => f3 +ó => ó + +CYRILLIC SMALL LETTER EF: ф => f4 +ô => ô + +CYRILLIC SMALL LETTER HA: х => f5 +õ => õ + +CYRILLIC SMALL LETTER TSE: ц => f6 +ö => ö + +CYRILLIC SMALL LETTER CHE: ч => f7 +÷ => ÷ + +CYRILLIC SMALL LETTER SHA: ш => f8 +ø => ø + +CYRILLIC SMALL LETTER SHCHA: щ => f9 +ù => ù + +CYRILLIC SMALL LETTER HARD SIGN: ъ => fa +ú => ú + +CYRILLIC SMALL LETTER YERU: ы => fb +û => û + +CYRILLIC SMALL LETTER SOFT SIGN: ь => fc +ü => ü + +CYRILLIC SMALL LETTER E: э => fd +ý => ý + +CYRILLIC SMALL LETTER YU: ю => fe +þ => þ + +CYRILLIC SMALL LETTER YA: я => ff +ÿ => ÿ diff --git a/tests/std/strings/html_entity_decode_win1252.phpt b/tests/std/strings/html_entity_decode_win1252.phpt new file mode 100644 index 00000000..4341426c --- /dev/null +++ b/tests/std/strings/html_entity_decode_win1252.phpt @@ -0,0 +1,168 @@ +--TEST-- +Translation of HTML entities for encoding WIN-1252 +--FILE-- + array(0x80, "EURO SIGN"), +//0x81 #UNDEFINED +0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"), +0x0192 => array(0x83, "LATIN SMALL LETTER F WITH HOOK"), +0x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"), +0x2026 => array(0x85, "HORIZONTAL ELLIPSIS"), +0x2020 => array(0x86, "DAGGER"), +0x2021 => array(0x87, "DOUBLE DAGGER"), +0x02C6 => array(0x88, "MODIFIER LETTER CIRCUMFLEX ACCENT"), +0x2030 => array(0x89, "PER MILLE SIGN"), +0x0160 => array(0x8A, "LATIN CAPITAL LETTER S WITH CARON"), +0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"), +0x0152 => array(0x8C, "LATIN CAPITAL LIGATURE OE"), +//0x8D #UNDEFINED +0x017D => array(0x8E, "LATIN CAPITAL LETTER Z WITH CARON"), +//0x8F #UNDEFINED +//0x90 #UNDEFINED +0x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"), +0x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"), +0x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"), +0x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"), +0x2022 => array(0x95, "BULLET"), +0x2013 => array(0x96, "EN DASH"), +0x2014 => array(0x97, "EM DASH"), +0x02DC => array(0x98, "SMALL TILDE"), +0x2122 => array(0x99, "TRADE MARK SIGN"), +0x0161 => array(0x9A, "LATIN SMALL LETTER S WITH CARON"), +0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"), +0x0153 => array(0x9C, "LATIN SMALL LIGATURE OE"), +//0x9D #UNDEFINED +0x017E => array(0x9E, "LATIN SMALL LETTER Z WITH CARON"), +0x0178 => array(0x9F, "LATIN CAPITAL LETTER Y WITH DIAERESIS"), +); + +$res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +$res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +$res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +$res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +$res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252'); +echo "Special test for  (shouldn't decode):\n"; +echo $res,"\n\n"; + +foreach ($arr as $u => $v) { + $ent = sprintf("&#x%X;", $u); + $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252'); + $d = unpack("H*", $res); + echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); + + $ent = sprintf("&#x%X;", $v[0]); + $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252'); + if ($res[0] != "&" || $res[1] != "#") + $res = unpack("H*", $res)[1]; + echo sprintf("%s => %s\n\n", $ent, $res); +} +?> +--EXPECT-- +Special test for  (shouldn't decode): + + +Special test for  (shouldn't decode): + + +Special test for  (shouldn't decode): + + +Special test for  (shouldn't decode): + + +Special test for  (shouldn't decode): + + +EURO SIGN: € => 80 +€ => € + +SINGLE LOW-9 QUOTATION MARK: ‚ => 82 +‚ => ‚ + +LATIN SMALL LETTER F WITH HOOK: ƒ => 83 +ƒ => ƒ + +DOUBLE LOW-9 QUOTATION MARK: „ => 84 +„ => „ + +HORIZONTAL ELLIPSIS: … => 85 +… => … + +DAGGER: † => 86 +† => † + +DOUBLE DAGGER: ‡ => 87 +‡ => ‡ + +MODIFIER LETTER CIRCUMFLEX ACCENT: ˆ => 88 +ˆ => ˆ + +PER MILLE SIGN: ‰ => 89 +‰ => ‰ + +LATIN CAPITAL LETTER S WITH CARON: Š => 8a +Š => Š + +SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => 8b +‹ => ‹ + +LATIN CAPITAL LIGATURE OE: Œ => 8c +Œ => Œ + +LATIN CAPITAL LETTER Z WITH CARON: Ž => 8e +Ž => Ž + +LEFT SINGLE QUOTATION MARK: ‘ => 91 +‘ => ‘ + +RIGHT SINGLE QUOTATION MARK: ’ => 92 +’ => ’ + +LEFT DOUBLE QUOTATION MARK: “ => 93 +“ => “ + +RIGHT DOUBLE QUOTATION MARK: ” => 94 +” => ” + +BULLET: • => 95 +• => • + +EN DASH: – => 96 +– => – + +EM DASH: — => 97 +— => — + +SMALL TILDE: ˜ => 98 +˜ => ˜ + +TRADE MARK SIGN: ™ => 99 +™ => ™ + +LATIN SMALL LETTER S WITH CARON: š => 9a +š => š + +SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => 9b +› => › + +LATIN SMALL LIGATURE OE: œ => 9c +œ => œ + +LATIN SMALL LETTER Z WITH CARON: ž => 9e +ž => ž + +LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => 9f +Ÿ => Ÿ diff --git a/tests/std/strings/htmlentities-utf-2.phpt b/tests/std/strings/htmlentities-utf-2.phpt new file mode 100644 index 00000000..1fdd05e2 --- /dev/null +++ b/tests/std/strings/htmlentities-utf-2.phpt @@ -0,0 +1,70 @@ +--TEST-- +HTML entities with invalid chars and ENT_IGNORE +--INI-- +output_handler= +--FILE-- + +--EXPECT-- +string(8) "266c743b" +string(8) "266c743b" +string(0) "" +string(0) "" +string(4) "d090" +string(4) "d090" +string(4) "d090" +string(4) "d090" +string(8) "d090d0b0" +string(8) "d090d0b0" +string(0) "" +string(0) "" +string(2) "41" +string(2) "41" +string(0) "" +string(0) "" +string(2) "79" +string(2) "79" +string(0) "" +string(0) "" +string(8) "566f696c" +string(8) "566f696c" +string(12) "436c69636873" +string(12) "436c69636873" +string(0) "" +string(0) "" +string(2) "41" +string(2) "41" +string(4) "c3a9" +string(16) "266561637574653b" +string(2) "79" +string(2) "79" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "4142" +string(4) "4142" +string(4) "4242" +string(4) "4242" +string(4) "4342" +string(4) "4342" +string(2) "44" +string(2) "44" +string(2) "45" +string(2) "45" +string(2) "46" +string(2) "46" diff --git a/tests/std/strings/htmlentities-utf-3.phpt b/tests/std/strings/htmlentities-utf-3.phpt new file mode 100644 index 00000000..9a7a13e2 --- /dev/null +++ b/tests/std/strings/htmlentities-utf-3.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF-8 sequences +--SKIPIF-- + +--FILE-- += $l[0][0] && $b <= $l[0][1]) { + if (count($l) != strlen($seq)) { + return false; + } + for ($n = 1; $n < strlen($seq); $n++) { + if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) { + return false; + } + } + return true; + } + } + return false; +} + +function concordance($s) { + $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0; + $v = is_valid($s); + return ($vhe === $v); +} + +for ($b1 = 0xC0; $b1 < 0xE0; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2); + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} + + +for ($b1 = 0xE0; $b1 < 0xEF; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2)."\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} + +for ($b1 = 0xF0; $b1 < 0xFF; $b1++) { + for ($b2 = 0x80; $b2 < 0xBF; $b2++) { + $s = chr($b1).chr($b2)."\x80\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF\x80"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\x80\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + $s = chr($b1).chr($b2)."\xBF\xBF"; + if (!concordance($s)) + echo "Discordance for ".bin2hex($s),"\n"; + } +} +echo "Done.\n"; +?> +--EXPECT-- +Done. diff --git a/tests/std/strings/htmlentities-utf.phpt b/tests/std/strings/htmlentities-utf.phpt new file mode 100644 index 00000000..53253785 --- /dev/null +++ b/tests/std/strings/htmlentities-utf.phpt @@ -0,0 +1,70 @@ +--TEST-- +HTML entities with invalid chars +--INI-- +output_handler= +--FILE-- + +--EXPECT-- +string(8) "266c743b" +string(8) "266c743b" +string(0) "" +string(0) "" +string(4) "d090" +string(4) "d090" +string(0) "" +string(0) "" +string(8) "d090d0b0" +string(8) "d090d0b0" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(4) "c3a9" +string(16) "266561637574653b" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" diff --git a/tests/std/strings/htmlentities.phpt b/tests/std/strings/htmlentities.phpt new file mode 100644 index 00000000..d9c67f33 --- /dev/null +++ b/tests/std/strings/htmlentities.phpt @@ -0,0 +1,23 @@ +--TEST-- +HTML entities of ISO-8859 chars +--SKIPIF-- + +--INI-- +output_handler= +--FILE-- +\"&åÄ\n",ENT_COMPAT,"ISO-8859-1"); +echo $sc_encoded; +$ent_encoded = htmlentities ("<>\"&åÄ\n",ENT_COMPAT,"ISO-8859-1"); +echo $ent_encoded; +echo html_entity_decode($sc_encoded,ENT_COMPAT,"ISO-8859-1"); +echo html_entity_decode($ent_encoded,ENT_COMPAT,"ISO-8859-1"); +?> +--EXPECT-- +<>"&åÄ +<>"&åÄ +<>"&åÄ +<>"&åÄ diff --git a/tests/std/strings/htmlentities01.phpt b/tests/std/strings/htmlentities01.phpt new file mode 100644 index 00000000..32f9e8ed --- /dev/null +++ b/tests/std/strings/htmlentities01.phpt @@ -0,0 +1,12 @@ +--TEST-- +htmlentities() test 1 (cp1252) +--INI-- +output_handler= +--FILE-- + +--EXPECT-- +string(28) "‚†™Ÿ" +string(32) "€¢£¤¥" diff --git a/tests/std/strings/htmlentities02.phpt b/tests/std/strings/htmlentities02.phpt new file mode 100644 index 00000000..e8d0b5b9 --- /dev/null +++ b/tests/std/strings/htmlentities02.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15) +--SKIPIF-- + +--INI-- +output_handler= +default_charset= +internal_encoding= +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/tests/std/strings/htmlentities03.phpt b/tests/std/strings/htmlentities03.phpt new file mode 100644 index 00000000..973bafed --- /dev/null +++ b/tests/std/strings/htmlentities03.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 3 (setlocale / de_DE.ISO-8859-1) +--SKIPIF-- + +--INI-- +output_handler= +default_charset= +internal_encoding= +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/tests/std/strings/htmlentities05.phpt b/tests/std/strings/htmlentities05.phpt new file mode 100644 index 00000000..b4827b31 --- /dev/null +++ b/tests/std/strings/htmlentities05.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 5 (mbstring / cp1252) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=cp1252 +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +Windows-1252 +string(28) "‚†™Ÿ" +string(32) "€¢£¤¥" diff --git a/tests/std/strings/htmlentities06.phpt b/tests/std/strings/htmlentities06.phpt new file mode 100644 index 00000000..a8355ccb --- /dev/null +++ b/tests/std/strings/htmlentities06.phpt @@ -0,0 +1,19 @@ +--TEST-- +htmlentities() test 6 (mbstring / ISO-8859-15) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=ISO-8859-15 +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +ISO-8859-15 +string(20) "ŒœŸ" diff --git a/tests/std/strings/htmlentities07.phpt b/tests/std/strings/htmlentities07.phpt new file mode 100644 index 00000000..720c4ea6 --- /dev/null +++ b/tests/std/strings/htmlentities07.phpt @@ -0,0 +1,19 @@ +--TEST-- +htmlentities() test 7 (mbstring / ISO-8859-1) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=ISO-8859-1 +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +ISO-8859-1 +string(18) "äöü" diff --git a/tests/std/strings/htmlentities08.phpt b/tests/std/strings/htmlentities08.phpt new file mode 100644 index 00000000..be5ee37e --- /dev/null +++ b/tests/std/strings/htmlentities08.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 8 (mbstring / EUC-JP) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=EUC-JP +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECTF-- +EUC-JP + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(6) "¡¢¡£¡¤" diff --git a/tests/std/strings/htmlentities09.phpt b/tests/std/strings/htmlentities09.phpt new file mode 100644 index 00000000..02eb0585 --- /dev/null +++ b/tests/std/strings/htmlentities09.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 9 (mbstring / Shift_JIS) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=Shift_JIS +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECTF-- +SJIS + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(12) "814181428143" diff --git a/tests/std/strings/htmlentities10.phpt b/tests/std/strings/htmlentities10.phpt new file mode 100644 index 00000000..4859162c --- /dev/null +++ b/tests/std/strings/htmlentities10.phpt @@ -0,0 +1,19 @@ +--TEST-- +htmlentities() test 10 (default_charset / cp1252) +--SKIPIF-- + +--INI-- +output_handler= +default_charset=cp1252 +--FILE-- + +--EXPECT-- +cp1252 +string(28) "‚†™Ÿ" +string(32) "€¢£¤¥" diff --git a/tests/std/strings/htmlentities11.phpt b/tests/std/strings/htmlentities11.phpt new file mode 100644 index 00000000..86a9629b --- /dev/null +++ b/tests/std/strings/htmlentities11.phpt @@ -0,0 +1,17 @@ +--TEST-- +htmlentities() test 11 (default_charset / ISO-8859-15) +--SKIPIF-- + +--INI-- +output_handler= +default_charset=ISO-8859-15 +--FILE-- + +--EXPECT-- +ISO-8859-15 +string(20) "ŒœŸ" diff --git a/tests/std/strings/htmlentities12.phpt b/tests/std/strings/htmlentities12.phpt new file mode 100644 index 00000000..bf93cba9 --- /dev/null +++ b/tests/std/strings/htmlentities12.phpt @@ -0,0 +1,17 @@ +--TEST-- +htmlentities() test 12 (default_charset / ISO-8859-1) +--SKIPIF-- + +--INI-- +output_handler= +default_charset=ISO-8859-1 +--FILE-- + +--EXPECT-- +ISO-8859-1 +string(18) "äöü" diff --git a/tests/std/strings/htmlentities13.phpt b/tests/std/strings/htmlentities13.phpt new file mode 100644 index 00000000..89d732ea --- /dev/null +++ b/tests/std/strings/htmlentities13.phpt @@ -0,0 +1,20 @@ +--TEST-- +htmlentities() test 13 (default_charset / EUC-JP) +--SKIPIF-- + +--INI-- +output_handler= +default_charset=EUC-JP +filter.default=unsafe_raw +--FILE-- + +--EXPECTF-- +EUC-JP + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d +string(6) "¡¢¡£¡¤" diff --git a/tests/std/strings/htmlentities14.phpt b/tests/std/strings/htmlentities14.phpt new file mode 100644 index 00000000..1704c0f0 --- /dev/null +++ b/tests/std/strings/htmlentities14.phpt @@ -0,0 +1,20 @@ +--TEST-- +htmlentities() test 14 (default_charset / Shift_JIS) +--SKIPIF-- + +--INI-- +output_handler= +default_charset=Shift_JIS +filter.default=unsafe_raw +--FILE-- + +--EXPECTF-- +Shift_JIS + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d +string(6) "ABC" diff --git a/tests/std/strings/htmlentities16.phpt b/tests/std/strings/htmlentities16.phpt new file mode 100644 index 00000000..30365b24 --- /dev/null +++ b/tests/std/strings/htmlentities16.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() test 16 (mbstring / cp1251) +--SKIPIF-- + +--INI-- +output_handler= +internal_encoding=cp1251 +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +string(22) "88a9f0eef1eaeef8edfbe9" +string(42) "266575726f3b26636f70793bf0eef1eaeef8edfbe9" +string(58) "€©роскошный" diff --git a/tests/std/strings/htmlentities17.phpt b/tests/std/strings/htmlentities17.phpt new file mode 100644 index 00000000..5e29de5d --- /dev/null +++ b/tests/std/strings/htmlentities17.phpt @@ -0,0 +1,47 @@ +--TEST-- +htmlentities() / html_entity_decode() #8592 - #9002 table test +--FILE-- + +--EXPECT-- +string(7) "⊕" +string(8) "⊗" +string(6) "⊥" +string(6) "⋅" +string(7) "⌈" +string(7) "⌉" +string(8) "⌊" +string(8) "⌋" +string(6) "⟨" +string(6) "⟩" +string(6) "e28a95" +string(6) "e28a97" +string(6) "e28aa5" +string(6) "e28b85" +string(6) "e28c88" +string(6) "e28c89" +string(6) "e28c8a" +string(6) "e28c8b" +string(6) "e28ca9" +string(6) "e28caa" diff --git a/tests/std/strings/htmlentities18.phpt b/tests/std/strings/htmlentities18.phpt new file mode 100644 index 00000000..d9582e7d --- /dev/null +++ b/tests/std/strings/htmlentities18.phpt @@ -0,0 +1,43 @@ +--TEST-- +htmlentities() / htmlspecialchars() "don't double encode" flag support +--FILE-- + +--EXPECT-- +string(3) "abc" +string(3) "abc" +string(13) "abc&sfdsa" +string(13) "abc&sfdsa" +string(33) "test+s & some more D" +string(33) "test+s & some more D" +string(34) "test+s & some more D" +string(34) "test+s & some more D" +string(43) "&; &amp &#a; &9; &#xyz;" +string(43) "&; &amp &#a; &9; &#xyz;" +string(32) "&kffjadfdhsjfhjasdhffasdfas;" +string(32) "&kffjadfdhsjfhjasdhffasdfas;" +string(16) "&#8787978789" +string(16) "&#8787978789" +string(5) "&" +string(5) "&" +string(15) "&&&" +string(15) "&&&" +string(17) "&ab&&" +string(17) "&ab&&" diff --git a/tests/std/strings/htmlentities19.phpt b/tests/std/strings/htmlentities19.phpt new file mode 100644 index 00000000..bc607ad2 --- /dev/null +++ b/tests/std/strings/htmlentities19.phpt @@ -0,0 +1,30 @@ +--TEST-- +htmlentities() / htmlspecialchars() ENT_SUBSTITUTE +--FILE-- + +--EXPECT-- +string(9) "A�>B" +string(18) "41efbfbd2667743b42" +string(9) "A�>B" +string(18) "41efbfbd2667743b42" +string(9) "�"" +string(18) "efbfbd2671756f743b" +string(9) "�"" +string(18) "efbfbd2671756f743b" +string(18) "A��B�C☺�" +string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd" +string(18) "A��B�C☺�" +string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd" diff --git a/tests/std/strings/htmlentities20.phpt b/tests/std/strings/htmlentities20.phpt new file mode 100644 index 00000000..d14a4de9 --- /dev/null +++ b/tests/std/strings/htmlentities20.phpt @@ -0,0 +1,203 @@ +--TEST-- +htmlentities() / htmlspecialchars() ENT_DISALLOWED +--SKIPIF-- + +--FILE-- +> 6), + 0x80 | ($k & 0x3f)); + } else if ($k < 0x10000) { + $retval = pack('C3', + 0xe0 | ($k >> 12), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } else { + $retval = pack('C4', + 0xf0 | ($k >> 18), + 0x80 | (($k >> 12) & 0x3f), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } + return $retval; +} + +$tests = array( + 0x00, //C0 + 0x01, + 0x09, + 0x0A, + 0x0B, + 0x0C, + 0x0D, + 0x0E, + 0x1F, + 0x20, //allowed always + 0x7F, //DEL + 0x80, //C1 + 0x9F, + 0xA0, //allowed always + 0xD7FF, //surrogates + 0xD800, + 0xDFFF, + 0xE000, //allowed always + 0xFFFE, //nonchar + 0xFFFF, + 0xFDCF, //allowed always + 0xFDD0, //nonchar + 0xFDEF, + 0xFDF0, //allowed always + 0x2FFFE, //nonchar + 0x2FFFF, +); +$tests2 = array_map('codepoint_to_utf8', $tests); + +$subchr = codepoint_to_utf8(0xFFFD); + +function test($flag) { + global $tests, $tests2; + $i = -1; + foreach ($tests2 as $test) { + $i++; + $a = htmlentities($test, $flag | ENT_DISALLOWED, "UTF-8"); + $b = htmlspecialchars($test, $flag | ENT_DISALLOWED, "UTF-8"); + if ($a == "" && $b == "") { echo sprintf("%05X", $tests[$i]), ": INVALID SEQUENCE\n"; continue; } + echo sprintf("%05X", $tests[$i]), ": ", bin2hex($a), " ", bin2hex($b), "\n"; + } +} + +echo "*** Testing HTML 4.01 ***\n"; + +test(ENT_HTML401); + +echo "\n*** Testing XHTML 1.0 ***\n"; + +test(ENT_XHTML); + +echo "\n*** Testing HTML 5 ***\n"; + +test(ENT_HTML5); + +echo "\n*** Testing XML 1.0 ***\n"; + +test(ENT_XML1); + +?> +--EXPECT-- +*** Testing HTML 4.01 *** +00000: efbfbd efbfbd +00001: efbfbd efbfbd +00009: 09 09 +0000A: 0a 0a +0000B: efbfbd efbfbd +0000C: efbfbd efbfbd +0000D: 0d 0d +0000E: efbfbd efbfbd +0001F: efbfbd efbfbd +00020: 20 20 +0007F: efbfbd efbfbd +00080: efbfbd efbfbd +0009F: efbfbd efbfbd +000A0: 266e6273703b c2a0 +0D7FF: ed9fbf ed9fbf +0D800: INVALID SEQUENCE +0DFFF: INVALID SEQUENCE +0E000: ee8080 ee8080 +0FFFE: efbfbe efbfbe +0FFFF: efbfbf efbfbf +0FDCF: efb78f efb78f +0FDD0: efb790 efb790 +0FDEF: efb7af efb7af +0FDF0: efb7b0 efb7b0 +2FFFE: f0afbfbe f0afbfbe +2FFFF: f0afbfbf f0afbfbf + +*** Testing XHTML 1.0 *** +00000: efbfbd efbfbd +00001: efbfbd efbfbd +00009: 09 09 +0000A: 0a 0a +0000B: efbfbd efbfbd +0000C: efbfbd efbfbd +0000D: 0d 0d +0000E: efbfbd efbfbd +0001F: efbfbd efbfbd +00020: 20 20 +0007F: 7f 7f +00080: c280 c280 +0009F: c29f c29f +000A0: 266e6273703b c2a0 +0D7FF: ed9fbf ed9fbf +0D800: INVALID SEQUENCE +0DFFF: INVALID SEQUENCE +0E000: ee8080 ee8080 +0FFFE: efbfbd efbfbd +0FFFF: efbfbd efbfbd +0FDCF: efb78f efb78f +0FDD0: efb790 efb790 +0FDEF: efb7af efb7af +0FDF0: efb7b0 efb7b0 +2FFFE: f0afbfbe f0afbfbe +2FFFF: f0afbfbf f0afbfbf + +*** Testing HTML 5 *** +00000: efbfbd efbfbd +00001: efbfbd efbfbd +00009: 265461623b 09 +0000A: 264e65774c696e653b 0a +0000B: efbfbd efbfbd +0000C: 0c 0c +0000D: 0d 0d +0000E: efbfbd efbfbd +0001F: efbfbd efbfbd +00020: 20 20 +0007F: efbfbd efbfbd +00080: efbfbd efbfbd +0009F: efbfbd efbfbd +000A0: 266e6273703b c2a0 +0D7FF: ed9fbf ed9fbf +0D800: INVALID SEQUENCE +0DFFF: INVALID SEQUENCE +0E000: ee8080 ee8080 +0FFFE: efbfbd efbfbd +0FFFF: efbfbd efbfbd +0FDCF: efb78f efb78f +0FDD0: efbfbd efbfbd +0FDEF: efbfbd efbfbd +0FDF0: efb7b0 efb7b0 +2FFFE: efbfbd efbfbd +2FFFF: efbfbd efbfbd + +*** Testing XML 1.0 *** +00000: efbfbd efbfbd +00001: efbfbd efbfbd +00009: 09 09 +0000A: 0a 0a +0000B: efbfbd efbfbd +0000C: efbfbd efbfbd +0000D: 0d 0d +0000E: efbfbd efbfbd +0001F: efbfbd efbfbd +00020: 20 20 +0007F: 7f 7f +00080: c280 c280 +0009F: c29f c29f +000A0: c2a0 c2a0 +0D7FF: ed9fbf ed9fbf +0D800: INVALID SEQUENCE +0DFFF: INVALID SEQUENCE +0E000: ee8080 ee8080 +0FFFE: efbfbd efbfbd +0FFFF: efbfbd efbfbd +0FDCF: efb78f efb78f +0FDD0: efb790 efb790 +0FDEF: efb7af efb7af +0FDF0: efb7b0 efb7b0 +2FFFE: f0afbfbe f0afbfbe +2FFFF: f0afbfbf f0afbfbf diff --git a/tests/std/strings/htmlentities21.phpt b/tests/std/strings/htmlentities21.phpt new file mode 100644 index 00000000..ded2fab4 --- /dev/null +++ b/tests/std/strings/htmlentities21.phpt @@ -0,0 +1,312 @@ +--TEST-- +htmlentities() / htmlspecialchars() ENT_DISALLOWED charset variation +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing HTML 4.01/Windows-1251 *** +00000: 262378464646443b 262378464646443b +00001: 262378464646443b 262378464646443b +00009: 09 09 +0000A: 0a 0a +0000B: 262378464646443b 262378464646443b +0000C: 262378464646443b 262378464646443b +0000D: 0d 0d +0000E: 262378464646443b 262378464646443b +0001F: 262378464646443b 262378464646443b +00020: 20 20 +0007F: 262378464646443b 7f +00080: 80 80 +0009F: 9f 9f +000A0: 266e6273703b a0 + +*** Testing XHTML 1.0/Windows-1251 *** +00000: 262378464646443b 262378464646443b +00001: 262378464646443b 262378464646443b +00009: 09 09 +0000A: 0a 0a +0000B: 262378464646443b 262378464646443b +0000C: 262378464646443b 262378464646443b +0000D: 0d 0d +0000E: 262378464646443b 262378464646443b +0001F: 262378464646443b 262378464646443b +00020: 20 20 +0007F: 7f 7f +00080: 80 80 +0009F: 9f 9f +000A0: 266e6273703b a0 + +*** Testing HTML 5/Windows-1251 *** +00000: 262378464646443b 262378464646443b +00001: 262378464646443b 262378464646443b +00009: 265461623b 09 +0000A: 264e65774c696e653b 0a +0000B: 262378464646443b 262378464646443b +0000C: 0c 0c +0000D: 0d 0d +0000E: 262378464646443b 262378464646443b +0001F: 262378464646443b 262378464646443b +00020: 20 20 +0007F: 262378464646443b 7f +00080: 26444a63793b 80 +0009F: 26647a63793b 9f +000A0: 266e6273703b a0 + +*** Testing XML 1.0/Windows-1251 *** +00000: 262378464646443b 262378464646443b +00001: 262378464646443b 262378464646443b +00009: 09 09 +0000A: 0a 0a +0000B: 262378464646443b 262378464646443b +0000C: 262378464646443b 262378464646443b +0000D: 0d 0d +0000E: 262378464646443b 262378464646443b +0001F: 262378464646443b 262378464646443b +00020: 20 20 +0007F: 7f 7f +00080: 80 80 +0009F: 9f 9f +000A0: a0 a0 + +*** Testing HTML 4.01/SJIS *** + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00000: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00001: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00009: 09 09 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000A: 0a 0a + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000B: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000C: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000D: 0d 0d + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000E: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0001F: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00020: 20 20 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0007F: 7f 7f + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00080: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0009F: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +000A0: INVALID SEQUENCE + +*** Testing XHTML 1.0/SJIS *** + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00000: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00001: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00009: 09 09 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000A: 0a 0a + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000B: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000C: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000D: 0d 0d + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000E: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0001F: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00020: 20 20 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0007F: 7f 7f + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00080: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0009F: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +000A0: INVALID SEQUENCE + +*** Testing HTML 5/SJIS *** + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00000: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00001: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00009: 09 09 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000A: 0a 0a + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000B: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000C: 0c 0c + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000D: 0d 0d + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000E: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0001F: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00020: 20 20 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0007F: 7f 7f + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00080: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0009F: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +000A0: INVALID SEQUENCE + +*** Testing XML 1.0/SJIS *** + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00000: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00001: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00009: 09 09 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000A: 0a 0a + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000B: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000C: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000D: 0d 0d + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0000E: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0001F: 262378464646443b 262378464646443b + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00020: 20 20 + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0007F: 7f 7f + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +00080: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +0009F: INVALID SEQUENCE + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +000A0: INVALID SEQUENCE diff --git a/tests/std/strings/htmlentities22.phpt b/tests/std/strings/htmlentities22.phpt new file mode 100644 index 00000000..945ace5b --- /dev/null +++ b/tests/std/strings/htmlentities22.phpt @@ -0,0 +1,339 @@ +--TEST-- +htmlentities() / htmlspecialchars() ENT_DISALLOWED with entities and no double encode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing HTML 4.01 *** +� NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED +€ NOT CHANGED +Ÿ NOT CHANGED +  NOT CHANGED +퟿ NOT CHANGED +� NOT CHANGED +� NOT CHANGED + NOT CHANGED +￾ NOT CHANGED +￿ NOT CHANGED +﷏ NOT CHANGED +﷐ NOT CHANGED +﷯ NOT CHANGED +ﷰ NOT CHANGED +𯿾 NOT CHANGED +𯿿 NOT CHANGED +� CHANGED + +*** Testing XHTML 1.0 *** +� CHANGED + CHANGED + NOT CHANGED + NOT CHANGED + CHANGED + CHANGED + NOT CHANGED + CHANGED + CHANGED + NOT CHANGED + NOT CHANGED +€ NOT CHANGED +Ÿ NOT CHANGED +  NOT CHANGED +퟿ NOT CHANGED +� CHANGED +� CHANGED + NOT CHANGED +￾ CHANGED +￿ CHANGED +﷏ NOT CHANGED +﷐ NOT CHANGED +﷯ NOT CHANGED +ﷰ NOT CHANGED +𯿾 NOT CHANGED +𯿿 NOT CHANGED +� CHANGED + +*** Testing HTML 5 *** +� CHANGED (&#0;, &#0;) + CHANGED (&#1;, &#1;) + NOT CHANGED + NOT CHANGED + CHANGED (&#x0B;, &#x0B;) + NOT CHANGED + CHANGED (&#x0D;, &#x0D;) + CHANGED (&#x0E;, &#x0E;) + CHANGED (&#x1F;, &#x1F;) + NOT CHANGED + CHANGED (&#x7F;, &#x7F;) +€ CHANGED (&#x80;, &#x80;) +Ÿ CHANGED (&#x9F;, &#x9F;) +  NOT CHANGED +퟿ NOT CHANGED +� NOT CHANGED +� NOT CHANGED + NOT CHANGED +￾ CHANGED (&#xFFFE;, &#xFFFE;) +￿ CHANGED (&#xFFFF;, &#xFFFF;) +﷏ NOT CHANGED +﷐ CHANGED (&#xFDD0;, &#xFDD0;) +﷯ CHANGED (&#xFDEF;, &#xFDEF;) +ﷰ NOT CHANGED +𯿾 CHANGED (&#x2FFFE;, &#x2FFFE;) +𯿿 CHANGED (&#x2FFFF;, &#x2FFFF;) +� CHANGED (&#x110000;, &#x110000;) + +*** Testing XML 1.0 *** +� CHANGED + CHANGED + NOT CHANGED + NOT CHANGED + CHANGED + CHANGED + NOT CHANGED + CHANGED + CHANGED + NOT CHANGED + NOT CHANGED +€ NOT CHANGED +Ÿ NOT CHANGED +  NOT CHANGED +퟿ NOT CHANGED +� CHANGED +� CHANGED + NOT CHANGED +￾ CHANGED +￿ CHANGED +﷏ NOT CHANGED +﷐ NOT CHANGED +﷯ NOT CHANGED +ﷰ NOT CHANGED +𯿾 NOT CHANGED +𯿿 NOT CHANGED +� CHANGED + +*** Testing 5 without the flag *** +� NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED + NOT CHANGED +€ NOT CHANGED +Ÿ NOT CHANGED +  NOT CHANGED +퟿ NOT CHANGED +� NOT CHANGED +� NOT CHANGED + NOT CHANGED +￾ NOT CHANGED +￿ NOT CHANGED +﷏ NOT CHANGED +﷐ NOT CHANGED +﷯ NOT CHANGED +ﷰ NOT CHANGED +𯿾 NOT CHANGED +𯿿 NOT CHANGED +� CHANGED (&#x110000;, &#x110000;) + +*** Testing HTML 5 with another single-byte encoding *** +� CHANGED (&#0;, &#0;) + CHANGED (&#1;, &#1;) + NOT CHANGED + NOT CHANGED + CHANGED (&#x0B;, &#x0B;) + NOT CHANGED + CHANGED (&#x0D;, &#x0D;) + CHANGED (&#x0E;, &#x0E;) + CHANGED (&#x1F;, &#x1F;) + NOT CHANGED + CHANGED (&#x7F;, &#x7F;) +€ CHANGED (&#x80;, &#x80;) +Ÿ CHANGED (&#x9F;, &#x9F;) +  NOT CHANGED +퟿ NOT CHANGED +� NOT CHANGED +� NOT CHANGED + NOT CHANGED +￾ CHANGED (&#xFFFE;, &#xFFFE;) +￿ CHANGED (&#xFFFF;, &#xFFFF;) +﷏ NOT CHANGED +﷐ CHANGED (&#xFDD0;, &#xFDD0;) +﷯ CHANGED (&#xFDEF;, &#xFDEF;) +ﷰ NOT CHANGED +𯿾 CHANGED (&#x2FFFE;, &#x2FFFE;) +𯿿 CHANGED (&#x2FFFF;, &#x2FFFF;) +� CHANGED (&#x110000;, &#x110000;) + +*** Testing HTML 5 with another multibyte-byte encoding *** + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +� CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +€ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +Ÿ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +  NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +퟿ NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +� NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +� NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d + NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +￾ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +￿ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +﷏ NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +﷐ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +﷯ CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +ﷰ NOT CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +𯿾 CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +𯿿 CHANGED + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +� CHANGED diff --git a/tests/std/strings/htmlentities23.phpt b/tests/std/strings/htmlentities23.phpt new file mode 100644 index 00000000..18307c12 --- /dev/null +++ b/tests/std/strings/htmlentities23.phpt @@ -0,0 +1,123 @@ +--TEST-- +htmlentities() / htmlspecialchars() ENT_SUBSTITUTE EUC-JP +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(16) "��" +string(32) "262378464646443b262378464646443b" +string(16) "��" +string(32) "262378464646443b262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(16) "��" +string(32) "262378464646443b262378464646443b" +string(16) "��" +string(32) "262378464646443b262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(17) "��!" +string(34) "262378464646443b262378464646443b21" +string(17) "��!" +string(34) "262378464646443b262378464646443b21" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(9) "�!" +string(18) "262378464646443b21" +string(9) "�!" +string(18) "262378464646443b21" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(2) "Ž®" +string(4) "8eae" +string(2) "Ž®" +string(4) "8eae" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(9) "�!" +string(18) "262378464646443b21" +string(9) "�!" +string(18) "262378464646443b21" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(9) "�!" +string(18) "262378464646443b21" +string(9) "�!" +string(18) "262378464646443b21" + + +Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d +string(8) "�" +string(16) "262378464646443b" +string(8) "�" +string(16) "262378464646443b" diff --git a/tests/std/strings/htmlentities24.phpt b/tests/std/strings/htmlentities24.phpt new file mode 100644 index 00000000..8754257d --- /dev/null +++ b/tests/std/strings/htmlentities24.phpt @@ -0,0 +1,313 @@ +--TEST-- +Test htmlentities() function +--FILE-- + This is a test! ") ); + +/* checking behavior of quote */ +echo "\n*** Testing htmlentites() on a quote ***\n"; +$str = "A 'quote' is bold"; +var_dump( htmlentities($str) ); +var_dump( htmlentities($str, ENT_QUOTES) ); +var_dump( htmlentities($str, ENT_NOQUOTES) ); +var_dump( htmlentities($str, ENT_COMPAT) ); + +echo "Done\n"; +?> +--EXPECT-- +*** Retrieving htmlentities for 256 characters *** +string(12) "636872283029" +string(12) "636872283129" +string(12) "636872283229" +string(12) "636872283329" +string(12) "636872283429" +string(12) "636872283529" +string(12) "636872283629" +string(12) "636872283729" +string(12) "636872283829" +string(12) "636872283929" +string(14) "63687228313029" +string(14) "63687228313129" +string(14) "63687228313229" +string(14) "63687228313329" +string(14) "63687228313429" +string(14) "63687228313529" +string(14) "63687228313629" +string(14) "63687228313729" +string(14) "63687228313829" +string(14) "63687228313929" +string(14) "63687228323029" +string(14) "63687228323129" +string(14) "63687228323229" +string(14) "63687228323329" +string(14) "63687228323429" +string(14) "63687228323529" +string(14) "63687228323629" +string(14) "63687228323729" +string(14) "63687228323829" +string(14) "63687228323929" +string(14) "63687228333029" +string(14) "63687228333129" +string(14) "63687228333229" +string(14) "63687228333329" +string(14) "63687228333429" +string(14) "63687228333529" +string(14) "63687228333629" +string(14) "63687228333729" +string(14) "63687228333829" +string(14) "63687228333929" +string(14) "63687228343029" +string(14) "63687228343129" +string(14) "63687228343229" +string(14) "63687228343329" +string(14) "63687228343429" +string(14) "63687228343529" +string(14) "63687228343629" +string(14) "63687228343729" +string(14) "63687228343829" +string(14) "63687228343929" +string(14) "63687228353029" +string(14) "63687228353129" +string(14) "63687228353229" +string(14) "63687228353329" +string(14) "63687228353429" +string(14) "63687228353529" +string(14) "63687228353629" +string(14) "63687228353729" +string(14) "63687228353829" +string(14) "63687228353929" +string(14) "63687228363029" +string(14) "63687228363129" +string(14) "63687228363229" +string(14) "63687228363329" +string(14) "63687228363429" +string(14) "63687228363529" +string(14) "63687228363629" +string(14) "63687228363729" +string(14) "63687228363829" +string(14) "63687228363929" +string(14) "63687228373029" +string(14) "63687228373129" +string(14) "63687228373229" +string(14) "63687228373329" +string(14) "63687228373429" +string(14) "63687228373529" +string(14) "63687228373629" +string(14) "63687228373729" +string(14) "63687228373829" +string(14) "63687228373929" +string(14) "63687228383029" +string(14) "63687228383129" +string(14) "63687228383229" +string(14) "63687228383329" +string(14) "63687228383429" +string(14) "63687228383529" +string(14) "63687228383629" +string(14) "63687228383729" +string(14) "63687228383829" +string(14) "63687228383929" +string(14) "63687228393029" +string(14) "63687228393129" +string(14) "63687228393229" +string(14) "63687228393329" +string(14) "63687228393429" +string(14) "63687228393529" +string(14) "63687228393629" +string(14) "63687228393729" +string(14) "63687228393829" +string(14) "63687228393929" +string(16) "6368722831303029" +string(16) "6368722831303129" +string(16) "6368722831303229" +string(16) "6368722831303329" +string(16) "6368722831303429" +string(16) "6368722831303529" +string(16) "6368722831303629" +string(16) "6368722831303729" +string(16) "6368722831303829" +string(16) "6368722831303929" +string(16) "6368722831313029" +string(16) "6368722831313129" +string(16) "6368722831313229" +string(16) "6368722831313329" +string(16) "6368722831313429" +string(16) "6368722831313529" +string(16) "6368722831313629" +string(16) "6368722831313729" +string(16) "6368722831313829" +string(16) "6368722831313929" +string(16) "6368722831323029" +string(16) "6368722831323129" +string(16) "6368722831323229" +string(16) "6368722831323329" +string(16) "6368722831323429" +string(16) "6368722831323529" +string(16) "6368722831323629" +string(16) "6368722831323729" +string(16) "6368722831323829" +string(16) "6368722831323929" +string(16) "6368722831333029" +string(16) "6368722831333129" +string(16) "6368722831333229" +string(16) "6368722831333329" +string(16) "6368722831333429" +string(16) "6368722831333529" +string(16) "6368722831333629" +string(16) "6368722831333729" +string(16) "6368722831333829" +string(16) "6368722831333929" +string(16) "6368722831343029" +string(16) "6368722831343129" +string(16) "6368722831343229" +string(16) "6368722831343329" +string(16) "6368722831343429" +string(16) "6368722831343529" +string(16) "6368722831343629" +string(16) "6368722831343729" +string(16) "6368722831343829" +string(16) "6368722831343929" +string(16) "6368722831353029" +string(16) "6368722831353129" +string(16) "6368722831353229" +string(16) "6368722831353329" +string(16) "6368722831353429" +string(16) "6368722831353529" +string(16) "6368722831353629" +string(16) "6368722831353729" +string(16) "6368722831353829" +string(16) "6368722831353929" +string(16) "6368722831363029" +string(16) "6368722831363129" +string(16) "6368722831363229" +string(16) "6368722831363329" +string(16) "6368722831363429" +string(16) "6368722831363529" +string(16) "6368722831363629" +string(16) "6368722831363729" +string(16) "6368722831363829" +string(16) "6368722831363929" +string(16) "6368722831373029" +string(16) "6368722831373129" +string(16) "6368722831373229" +string(16) "6368722831373329" +string(16) "6368722831373429" +string(16) "6368722831373529" +string(16) "6368722831373629" +string(16) "6368722831373729" +string(16) "6368722831373829" +string(16) "6368722831373929" +string(16) "6368722831383029" +string(16) "6368722831383129" +string(16) "6368722831383229" +string(16) "6368722831383329" +string(16) "6368722831383429" +string(16) "6368722831383529" +string(16) "6368722831383629" +string(16) "6368722831383729" +string(16) "6368722831383829" +string(16) "6368722831383929" +string(16) "6368722831393029" +string(16) "6368722831393129" +string(16) "6368722831393229" +string(16) "6368722831393329" +string(16) "6368722831393429" +string(16) "6368722831393529" +string(16) "6368722831393629" +string(16) "6368722831393729" +string(16) "6368722831393829" +string(16) "6368722831393929" +string(16) "6368722832303029" +string(16) "6368722832303129" +string(16) "6368722832303229" +string(16) "6368722832303329" +string(16) "6368722832303429" +string(16) "6368722832303529" +string(16) "6368722832303629" +string(16) "6368722832303729" +string(16) "6368722832303829" +string(16) "6368722832303929" +string(16) "6368722832313029" +string(16) "6368722832313129" +string(16) "6368722832313229" +string(16) "6368722832313329" +string(16) "6368722832313429" +string(16) "6368722832313529" +string(16) "6368722832313629" +string(16) "6368722832313729" +string(16) "6368722832313829" +string(16) "6368722832313929" +string(16) "6368722832323029" +string(16) "6368722832323129" +string(16) "6368722832323229" +string(16) "6368722832323329" +string(16) "6368722832323429" +string(16) "6368722832323529" +string(16) "6368722832323629" +string(16) "6368722832323729" +string(16) "6368722832323829" +string(16) "6368722832323929" +string(16) "6368722832333029" +string(16) "6368722832333129" +string(16) "6368722832333229" +string(16) "6368722832333329" +string(16) "6368722832333429" +string(16) "6368722832333529" +string(16) "6368722832333629" +string(16) "6368722832333729" +string(16) "6368722832333829" +string(16) "6368722832333929" +string(16) "6368722832343029" +string(16) "6368722832343129" +string(16) "6368722832343229" +string(16) "6368722832343329" +string(16) "6368722832343429" +string(16) "6368722832343529" +string(16) "6368722832343629" +string(16) "6368722832343729" +string(16) "6368722832343829" +string(16) "6368722832343929" +string(16) "6368722832353029" +string(16) "6368722832353129" +string(16) "6368722832353229" +string(16) "6368722832353329" +string(16) "6368722832353429" +string(16) "6368722832353529" + +*** Testing htmlentities() with NULL as first,second and third argument *** +string(0) "" +string(0) "" +string(0) "" + +*** Checking for proper memory allocation with long string *** +string(198) "‚†™Ÿ€‚†„€‰…ƒ†„€‘ƒ‘†‡…†ˆ‚‰’‘ƒ" + +*** Testing a normal string with htmlentities() *** +string(42) "<html> This is a test! </html>" + +*** Testing htmlentites() on a quote *** +string(46) "A 'quote' is <b>bold</b>" +string(46) "A 'quote' is <b>bold</b>" +string(36) "A 'quote' is <b>bold</b>" +string(36) "A 'quote' is <b>bold</b>" +Done diff --git a/tests/std/strings/htmlentities25.phpt b/tests/std/strings/htmlentities25.phpt new file mode 100644 index 00000000..62cd461f --- /dev/null +++ b/tests/std/strings/htmlentities25.phpt @@ -0,0 +1,21 @@ +--TEST-- +htmlentities() should not be influenced by mb_internal_encoding() +--SKIPIF-- + +--INI-- +default_charset= +internal_encoding= +mbstring.internal_encoding=ISO-8859-1 +--EXTENSIONS-- +mbstring +--FILE-- + +--EXPECT-- +Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0 +string(18) "äöü" diff --git a/tests/std/strings/htmlentities_html4.phpt b/tests/std/strings/htmlentities_html4.phpt new file mode 100644 index 00000000..d1ce6a6b --- /dev/null +++ b/tests/std/strings/htmlentities_html4.phpt @@ -0,0 +1,317 @@ +--TEST-- +htmlentities() conformance check (HTML 4) +--SKIPIF-- + +--FILE-- +> 6), + 0x80 | ($k & 0x3f)); + } else if ($k < 0x10000) { + $retval = pack('C3', + 0xe0 | ($k >> 12), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } else if ($k < 0x200000) { + $retval = pack('C4', + 0xf0 | ($k >> 18), + 0x80 | (($k >> 12) & 0x3f), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } else if ($k < 0x4000000) { + $retval = pack('C5', + 0xf8 | ($k >> 24), + 0x80 | (($k >> 18) & 0x3f), + 0x80 | (($k >> 12) & 0x3f), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } else { + $retval = pack('C6', + 0xfc | ($k >> 30), + 0x80 | (($k >> 24) & 0x3f), + 0x80 | (($k >> 18) & 0x3f), + 0x80 | (($k >> 12) & 0x3f), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } + return $retval; +} + +$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8'); + +for ($i = 0; $i < 0x2710; $i++) { + if ($i >= 0xd800 && $i < 0xe000) + continue; + $str = utf32_utf8($i); + if (isset($table[$str])) { + printf("%s\tU+%05X\n", $table[$str], $i); + unset($table[$str]); + } +} + +if (!empty($table)) { + echo "Not matched entities: "; + var_dump($table); +} + +?> +--EXPECT-- +" U+00022 +& U+00026 +' U+00027 +< U+0003C +> U+0003E +  U+000A0 +¡ U+000A1 +¢ U+000A2 +£ U+000A3 +¤ U+000A4 +¥ U+000A5 +¦ U+000A6 +§ U+000A7 +¨ U+000A8 +© U+000A9 +ª U+000AA +« U+000AB +¬ U+000AC +­ U+000AD +® U+000AE +¯ U+000AF +° U+000B0 +± U+000B1 +² U+000B2 +³ U+000B3 +´ U+000B4 +µ U+000B5 +¶ U+000B6 +· U+000B7 +¸ U+000B8 +¹ U+000B9 +º U+000BA +» U+000BB +¼ U+000BC +½ U+000BD +¾ U+000BE +¿ U+000BF +À U+000C0 +Á U+000C1 + U+000C2 +à U+000C3 +Ä U+000C4 +Å U+000C5 +Æ U+000C6 +Ç U+000C7 +È U+000C8 +É U+000C9 +Ê U+000CA +Ë U+000CB +Ì U+000CC +Í U+000CD +Î U+000CE +Ï U+000CF +Ð U+000D0 +Ñ U+000D1 +Ò U+000D2 +Ó U+000D3 +Ô U+000D4 +Õ U+000D5 +Ö U+000D6 +× U+000D7 +Ø U+000D8 +Ù U+000D9 +Ú U+000DA +Û U+000DB +Ü U+000DC +Ý U+000DD +Þ U+000DE +ß U+000DF +à U+000E0 +á U+000E1 +â U+000E2 +ã U+000E3 +ä U+000E4 +å U+000E5 +æ U+000E6 +ç U+000E7 +è U+000E8 +é U+000E9 +ê U+000EA +ë U+000EB +ì U+000EC +í U+000ED +î U+000EE +ï U+000EF +ð U+000F0 +ñ U+000F1 +ò U+000F2 +ó U+000F3 +ô U+000F4 +õ U+000F5 +ö U+000F6 +÷ U+000F7 +ø U+000F8 +ù U+000F9 +ú U+000FA +û U+000FB +ü U+000FC +ý U+000FD +þ U+000FE +ÿ U+000FF +Œ U+00152 +œ U+00153 +Š U+00160 +š U+00161 +Ÿ U+00178 +ƒ U+00192 +ˆ U+002C6 +˜ U+002DC +Α U+00391 +Β U+00392 +Γ U+00393 +Δ U+00394 +Ε U+00395 +Ζ U+00396 +Η U+00397 +Θ U+00398 +Ι U+00399 +Κ U+0039A +Λ U+0039B +Μ U+0039C +Ν U+0039D +Ξ U+0039E +Ο U+0039F +Π U+003A0 +Ρ U+003A1 +Σ U+003A3 +Τ U+003A4 +Υ U+003A5 +Φ U+003A6 +Χ U+003A7 +Ψ U+003A8 +Ω U+003A9 +α U+003B1 +β U+003B2 +γ U+003B3 +δ U+003B4 +ε U+003B5 +ζ U+003B6 +η U+003B7 +θ U+003B8 +ι U+003B9 +κ U+003BA +λ U+003BB +μ U+003BC +ν U+003BD +ξ U+003BE +ο U+003BF +π U+003C0 +ρ U+003C1 +ς U+003C2 +σ U+003C3 +τ U+003C4 +υ U+003C5 +φ U+003C6 +χ U+003C7 +ψ U+003C8 +ω U+003C9 +ϑ U+003D1 +ϒ U+003D2 +ϖ U+003D6 +  U+02002 +  U+02003 +  U+02009 +‌ U+0200C +‍ U+0200D +‎ U+0200E +‏ U+0200F +– U+02013 +— U+02014 +‘ U+02018 +’ U+02019 +‚ U+0201A +“ U+0201C +” U+0201D +„ U+0201E +† U+02020 +‡ U+02021 +• U+02022 +… U+02026 +‰ U+02030 +′ U+02032 +″ U+02033 +‹ U+02039 +› U+0203A +‾ U+0203E +⁄ U+02044 +€ U+020AC +ℑ U+02111 +℘ U+02118 +ℜ U+0211C +™ U+02122 +ℵ U+02135 +← U+02190 +↑ U+02191 +→ U+02192 +↓ U+02193 +↔ U+02194 +↵ U+021B5 +⇐ U+021D0 +⇑ U+021D1 +⇒ U+021D2 +⇓ U+021D3 +⇔ U+021D4 +∀ U+02200 +∂ U+02202 +∃ U+02203 +∅ U+02205 +∇ U+02207 +∈ U+02208 +∉ U+02209 +∋ U+0220B +∏ U+0220F +∑ U+02211 +− U+02212 +∗ U+02217 +√ U+0221A +∝ U+0221D +∞ U+0221E +∠ U+02220 +∧ U+02227 +∨ U+02228 +∩ U+02229 +∪ U+0222A +∫ U+0222B +∴ U+02234 +∼ U+0223C +≅ U+02245 +≈ U+02248 +≠ U+02260 +≡ U+02261 +≤ U+02264 +≥ U+02265 +⊂ U+02282 +⊃ U+02283 +⊄ U+02284 +⊆ U+02286 +⊇ U+02287 +⊕ U+02295 +⊗ U+02297 +⊥ U+022A5 +⋅ U+022C5 +⌈ U+02308 +⌉ U+02309 +⌊ U+0230A +⌋ U+0230B +⟨ U+02329 +⟩ U+0232A +◊ U+025CA +♠ U+02660 +♣ U+02663 +♥ U+02665 +♦ U+02666 diff --git a/tests/std/strings/htmlentities_html5.phpt b/tests/std/strings/htmlentities_html5.phpt new file mode 100644 index 00000000..6a963adf --- /dev/null +++ b/tests/std/strings/htmlentities_html5.phpt @@ -0,0 +1,1628 @@ +--TEST-- +htmlentities() conformance check (HTML 5) +--SKIPIF-- + +--FILE-- +> 6), + 0x80 | ($k & 0x3f)); + } else if ($k < 0x10000) { + $retval = pack('C3', + 0xe0 | ($k >> 12), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } else { + $retval = pack('C4', + 0xf0 | ($k >> 18), + 0x80 | (($k >> 12) & 0x3f), + 0x80 | (($k >> 6) & 0x3f), + 0x80 | ($k & 0x3f)); + } + return $retval; +} + +for ($i = 0; $i < 0x1DFFF; $i++) { + if ($i >= 0xd800 && $i < 0xe000) //surrogates + continue; + $str = utf32_utf8($i); + $result = htmlentities($str, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + if ($str != $result) { + printf("%s\tU+%05X\n", $result, $i); + } +} + +/* multicodepoint entities */ +$mpcent = array( +array(0x0003C, 0x20D2), +array(0x0003D, 0x20E5), +array(0x0003E, 0x20D2), +array(0x00066, 0x6A), +array(0x0205F, 0x200A), +array(0x0219D, 0x338), +array(0x02202, 0x338), +array(0x02220, 0x20D2), +array(0x02229, 0xFE00), +array(0x0222A, 0xFE00), +array(0x0223C, 0x020D2), +array(0x0223D, 0x00331), +array(0x0223E, 0x00333), +array(0x02242, 0x338), +array(0x0224B, 0x338), +array(0x0224D, 0x020D2), +array(0x0224E, 0x338), +array(0x0224F, 0x338), +array(0x02250, 0x338), +array(0x02261, 0x020E5), +array(0x02264, 0x20D2), +array(0x02265, 0x020D2), +array(0x02266, 0x338), +array(0x02267, 0x00338), +array(0x02268, 0xFE00), +array(0x02269, 0xFE00), +array(0x0226A, 0x338), +array(0x0226A, 0x20D2), +array(0x0226B, 0x338), +array(0x0226B, 0x20D2), +array(0x0227F, 0x338), +array(0x02282, 0x20D2), +array(0x02283, 0x20D2), +array(0x0228A, 0xFE00), +array(0x0228B, 0xFE00), +array(0x0228F, 0x338), +array(0x02290, 0x338), +array(0x02293, 0xFE00), +array(0x02294, 0xFE00), +array(0x022B4, 0x20D2), +array(0x022B5, 0x20D2), +array(0x022D8, 0x338), +array(0x022D9, 0x338), +array(0x022DA, 0xFE00), +array(0x022DB, 0xFE00), +array(0x022F5, 0x338), +array(0x022F9, 0x338), +array(0x02933, 0x338), +array(0x029CF, 0x338), +array(0x029D0, 0x338), +array(0x02A6D, 0x338), +array(0x02A70, 0x338), +array(0x02A7D, 0x338), +array(0x02A7E, 0x338), +array(0x02AA1, 0x338), +array(0x02AA2, 0x338), +array(0x02AAC, 0xFE00), +array(0x02AAD, 0xFE00), +array(0x02AAF, 0x338), +array(0x02AB0, 0x338), +array(0x02AC5, 0x338), +array(0x02AC6, 0x338), +array(0x02ACB, 0xFE00), +array(0x02ACC, 0xFE00), +array(0x02AFD, 0xFE00), +); + +foreach ($mpcent as $i) { + $str = utf32_utf8($i[0]); + $str .= utf32_utf8($i[1]); + $result = htmlentities($str, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + printf("%s\tU+%05X U+%05X\n", $result, $i[0], $i[1]); +} +?> +--EXPECT-- + U+00009 + U+0000A +! U+00021 +" U+00022 +# U+00023 +$ U+00024 +% U+00025 +& U+00026 +' U+00027 +( U+00028 +) U+00029 +* U+0002A ++ U+0002B +, U+0002C +. U+0002E +/ U+0002F +: U+0003A +; U+0003B +< U+0003C += U+0003D +> U+0003E +? U+0003F +@ U+00040 +[ U+0005B +\ U+0005C +] U+0005D +^ U+0005E +_ U+0005F +` U+00060 +{ U+0007B +| U+0007C +} U+0007D +  U+000A0 +¡ U+000A1 +¢ U+000A2 +£ U+000A3 +¤ U+000A4 +¥ U+000A5 +¦ U+000A6 +§ U+000A7 +¨ U+000A8 +© U+000A9 +ª U+000AA +« U+000AB +¬ U+000AC +­ U+000AD +® U+000AE +¯ U+000AF +° U+000B0 +± U+000B1 +² U+000B2 +³ U+000B3 +´ U+000B4 +µ U+000B5 +¶ U+000B6 +· U+000B7 +¸ U+000B8 +¹ U+000B9 +º U+000BA +» U+000BB +¼ U+000BC +½ U+000BD +¾ U+000BE +¿ U+000BF +À U+000C0 +Á U+000C1 + U+000C2 +à U+000C3 +Ä U+000C4 +Å U+000C5 +Æ U+000C6 +Ç U+000C7 +È U+000C8 +É U+000C9 +Ê U+000CA +Ë U+000CB +Ì U+000CC +Í U+000CD +Î U+000CE +Ï U+000CF +Ð U+000D0 +Ñ U+000D1 +Ò U+000D2 +Ó U+000D3 +Ô U+000D4 +Õ U+000D5 +Ö U+000D6 +× U+000D7 +Ø U+000D8 +Ù U+000D9 +Ú U+000DA +Û U+000DB +Ü U+000DC +Ý U+000DD +Þ U+000DE +ß U+000DF +à U+000E0 +á U+000E1 +â U+000E2 +ã U+000E3 +ä U+000E4 +å U+000E5 +æ U+000E6 +ç U+000E7 +è U+000E8 +é U+000E9 +ê U+000EA +ë U+000EB +ì U+000EC +í U+000ED +î U+000EE +ï U+000EF +ð U+000F0 +ñ U+000F1 +ò U+000F2 +ó U+000F3 +ô U+000F4 +õ U+000F5 +ö U+000F6 +÷ U+000F7 +ø U+000F8 +ù U+000F9 +ú U+000FA +û U+000FB +ü U+000FC +ý U+000FD +þ U+000FE +ÿ U+000FF +Ā U+00100 +ā U+00101 +Ă U+00102 +ă U+00103 +Ą U+00104 +ą U+00105 +Ć U+00106 +ć U+00107 +Ĉ U+00108 +ĉ U+00109 +Ċ U+0010A +ċ U+0010B +Č U+0010C +č U+0010D +Ď U+0010E +ď U+0010F +Đ U+00110 +đ U+00111 +Ē U+00112 +ē U+00113 +Ė U+00116 +ė U+00117 +Ę U+00118 +ę U+00119 +Ě U+0011A +ě U+0011B +Ĝ U+0011C +ĝ U+0011D +Ğ U+0011E +ğ U+0011F +Ġ U+00120 +ġ U+00121 +Ģ U+00122 +Ĥ U+00124 +ĥ U+00125 +Ħ U+00126 +ħ U+00127 +Ĩ U+00128 +ĩ U+00129 +Ī U+0012A +ī U+0012B +Į U+0012E +į U+0012F +İ U+00130 +ı U+00131 +IJ U+00132 +ij U+00133 +Ĵ U+00134 +ĵ U+00135 +Ķ U+00136 +ķ U+00137 +ĸ U+00138 +Ĺ U+00139 +ĺ U+0013A +Ļ U+0013B +ļ U+0013C +Ľ U+0013D +ľ U+0013E +Ŀ U+0013F +ŀ U+00140 +Ł U+00141 +ł U+00142 +Ń U+00143 +ń U+00144 +Ņ U+00145 +ņ U+00146 +Ň U+00147 +ň U+00148 +ʼn U+00149 +Ŋ U+0014A +ŋ U+0014B +Ō U+0014C +ō U+0014D +Ő U+00150 +ő U+00151 +Œ U+00152 +œ U+00153 +Ŕ U+00154 +ŕ U+00155 +Ŗ U+00156 +ŗ U+00157 +Ř U+00158 +ř U+00159 +Ś U+0015A +ś U+0015B +Ŝ U+0015C +ŝ U+0015D +Ş U+0015E +ş U+0015F +Š U+00160 +š U+00161 +Ţ U+00162 +ţ U+00163 +Ť U+00164 +ť U+00165 +Ŧ U+00166 +ŧ U+00167 +Ũ U+00168 +ũ U+00169 +Ū U+0016A +ū U+0016B +Ŭ U+0016C +ŭ U+0016D +Ů U+0016E +ů U+0016F +Ű U+00170 +ű U+00171 +Ų U+00172 +ų U+00173 +Ŵ U+00174 +ŵ U+00175 +Ŷ U+00176 +ŷ U+00177 +Ÿ U+00178 +Ź U+00179 +ź U+0017A +Ż U+0017B +ż U+0017C +Ž U+0017D +ž U+0017E +ƒ U+00192 +Ƶ U+001B5 +ǵ U+001F5 +ȷ U+00237 +ˆ U+002C6 +ˇ U+002C7 +˘ U+002D8 +˙ U+002D9 +˚ U+002DA +˛ U+002DB +˜ U+002DC +˝ U+002DD +̑ U+00311 +Α U+00391 +Β U+00392 +Γ U+00393 +Δ U+00394 +Ε U+00395 +Ζ U+00396 +Η U+00397 +Θ U+00398 +Ι U+00399 +Κ U+0039A +Λ U+0039B +Μ U+0039C +Ν U+0039D +Ξ U+0039E +Ο U+0039F +Π U+003A0 +Ρ U+003A1 +Σ U+003A3 +Τ U+003A4 +Υ U+003A5 +Φ U+003A6 +Χ U+003A7 +Ψ U+003A8 +Ω U+003A9 +α U+003B1 +β U+003B2 +γ U+003B3 +δ U+003B4 +ε U+003B5 +ζ U+003B6 +η U+003B7 +θ U+003B8 +ι U+003B9 +κ U+003BA +λ U+003BB +μ U+003BC +ν U+003BD +ξ U+003BE +ο U+003BF +π U+003C0 +ρ U+003C1 +ς U+003C2 +σ U+003C3 +τ U+003C4 +υ U+003C5 +φ U+003C6 +χ U+003C7 +ψ U+003C8 +ω U+003C9 +ϑ U+003D1 +ϒ U+003D2 +ϕ U+003D5 +ϖ U+003D6 +Ϝ U+003DC +ϝ U+003DD +ϰ U+003F0 +ϱ U+003F1 +ϵ U+003F5 +϶ U+003F6 +Ё U+00401 +Ђ U+00402 +Ѓ U+00403 +Є U+00404 +Ѕ U+00405 +І U+00406 +Ї U+00407 +Ј U+00408 +Љ U+00409 +Њ U+0040A +Ћ U+0040B +Ќ U+0040C +Ў U+0040E +Џ U+0040F +А U+00410 +Б U+00411 +В U+00412 +Г U+00413 +Д U+00414 +Е U+00415 +Ж U+00416 +З U+00417 +И U+00418 +Й U+00419 +К U+0041A +Л U+0041B +М U+0041C +Н U+0041D +О U+0041E +П U+0041F +Р U+00420 +С U+00421 +Т U+00422 +У U+00423 +Ф U+00424 +Х U+00425 +Ц U+00426 +Ч U+00427 +Ш U+00428 +Щ U+00429 +Ъ U+0042A +Ы U+0042B +Ь U+0042C +Э U+0042D +Ю U+0042E +Я U+0042F +а U+00430 +б U+00431 +в U+00432 +г U+00433 +д U+00434 +е U+00435 +ж U+00436 +з U+00437 +и U+00438 +й U+00439 +к U+0043A +л U+0043B +м U+0043C +н U+0043D +о U+0043E +п U+0043F +р U+00440 +с U+00441 +т U+00442 +у U+00443 +ф U+00444 +х U+00445 +ц U+00446 +ч U+00447 +ш U+00448 +щ U+00449 +ъ U+0044A +ы U+0044B +ь U+0044C +э U+0044D +ю U+0044E +я U+0044F +ё U+00451 +ђ U+00452 +ѓ U+00453 +є U+00454 +ѕ U+00455 +і U+00456 +ї U+00457 +ј U+00458 +љ U+00459 +њ U+0045A +ћ U+0045B +ќ U+0045C +ў U+0045E +џ U+0045F +  U+02002 +  U+02003 +  U+02004 +  U+02005 +  U+02007 +  U+02008 +  U+02009 +  U+0200A +​ U+0200B +‌ U+0200C +‍ U+0200D +‎ U+0200E +‏ U+0200F +‐ U+02010 +– U+02013 +— U+02014 +― U+02015 +‖ U+02016 +‘ U+02018 +’ U+02019 +‚ U+0201A +“ U+0201C +” U+0201D +„ U+0201E +† U+02020 +‡ U+02021 +• U+02022 +‥ U+02025 +… U+02026 +‰ U+02030 +‱ U+02031 +′ U+02032 +″ U+02033 +‴ U+02034 +‵ U+02035 +‹ U+02039 +› U+0203A +‾ U+0203E +⁁ U+02041 +⁃ U+02043 +⁄ U+02044 +⁏ U+0204F +⁗ U+02057 +  U+0205F +⁠ U+02060 +⁡ U+02061 +⁢ U+02062 +⁣ U+02063 +€ U+020AC +⃛ U+020DB +⃜ U+020DC +ℂ U+02102 +℅ U+02105 +ℊ U+0210A +ℋ U+0210B +ℌ U+0210C +ℍ U+0210D +ℎ U+0210E +ℏ U+0210F +ℐ U+02110 +ℑ U+02111 +ℒ U+02112 +ℓ U+02113 +ℕ U+02115 +№ U+02116 +℗ U+02117 +℘ U+02118 +ℙ U+02119 +ℚ U+0211A +ℛ U+0211B +ℜ U+0211C +ℝ U+0211D +℞ U+0211E +™ U+02122 +ℤ U+02124 +℧ U+02127 +ℨ U+02128 +℩ U+02129 +ℬ U+0212C +ℭ U+0212D +ℯ U+0212F +ℰ U+02130 +ℱ U+02131 +ℳ U+02133 +ℴ U+02134 +ℵ U+02135 +ℶ U+02136 +ℷ U+02137 +ℸ U+02138 +ⅅ U+02145 +ⅆ U+02146 +ⅇ U+02147 +ⅈ U+02148 +⅓ U+02153 +⅔ U+02154 +⅕ U+02155 +⅖ U+02156 +⅗ U+02157 +⅘ U+02158 +⅙ U+02159 +⅚ U+0215A +⅛ U+0215B +⅜ U+0215C +⅝ U+0215D +⅞ U+0215E +← U+02190 +↑ U+02191 +→ U+02192 +↓ U+02193 +↔ U+02194 +↕ U+02195 +↖ U+02196 +↗ U+02197 +↘ U+02198 +↙ U+02199 +↚ U+0219A +↛ U+0219B +↝ U+0219D +↞ U+0219E +↟ U+0219F +↠ U+021A0 +↡ U+021A1 +↢ U+021A2 +↣ U+021A3 +↤ U+021A4 +↥ U+021A5 +↦ U+021A6 +↧ U+021A7 +↩ U+021A9 +↪ U+021AA +↫ U+021AB +↬ U+021AC +↭ U+021AD +↮ U+021AE +↰ U+021B0 +↱ U+021B1 +↲ U+021B2 +↳ U+021B3 +↵ U+021B5 +↶ U+021B6 +↷ U+021B7 +↺ U+021BA +↻ U+021BB +↼ U+021BC +↽ U+021BD +↾ U+021BE +↿ U+021BF +⇀ U+021C0 +⇁ U+021C1 +⇂ U+021C2 +⇃ U+021C3 +⇄ U+021C4 +⇅ U+021C5 +⇆ U+021C6 +⇇ U+021C7 +⇈ U+021C8 +⇉ U+021C9 +⇊ U+021CA +⇋ U+021CB +⇌ U+021CC +⇍ U+021CD +⇎ U+021CE +⇏ U+021CF +⇐ U+021D0 +⇑ U+021D1 +⇒ U+021D2 +⇓ U+021D3 +⇔ U+021D4 +⇕ U+021D5 +⇖ U+021D6 +⇗ U+021D7 +⇘ U+021D8 +⇙ U+021D9 +⇚ U+021DA +⇛ U+021DB +⇝ U+021DD +⇤ U+021E4 +⇥ U+021E5 +⇵ U+021F5 +⇽ U+021FD +⇾ U+021FE +⇿ U+021FF +∀ U+02200 +∁ U+02201 +∂ U+02202 +∃ U+02203 +∄ U+02204 +∅ U+02205 +∇ U+02207 +∈ U+02208 +∉ U+02209 +∋ U+0220B +∌ U+0220C +∏ U+0220F +∐ U+02210 +∑ U+02211 +− U+02212 +∓ U+02213 +∔ U+02214 +∖ U+02216 +∗ U+02217 +∘ U+02218 +√ U+0221A +∝ U+0221D +∞ U+0221E +∟ U+0221F +∠ U+02220 +∡ U+02221 +∢ U+02222 +∣ U+02223 +∤ U+02224 +∥ U+02225 +∦ U+02226 +∧ U+02227 +∨ U+02228 +∩ U+02229 +∪ U+0222A +∫ U+0222B +∬ U+0222C +∭ U+0222D +∮ U+0222E +∯ U+0222F +∰ U+02230 +∱ U+02231 +∲ U+02232 +∳ U+02233 +∴ U+02234 +∵ U+02235 +∶ U+02236 +∷ U+02237 +∸ U+02238 +∺ U+0223A +∻ U+0223B +∼ U+0223C +∽ U+0223D +∾ U+0223E +∿ U+0223F +≀ U+02240 +≁ U+02241 +≂ U+02242 +≃ U+02243 +≄ U+02244 +≅ U+02245 +≆ U+02246 +≇ U+02247 +≈ U+02248 +≉ U+02249 +≊ U+0224A +≋ U+0224B +≌ U+0224C +≍ U+0224D +≎ U+0224E +≏ U+0224F +≐ U+02250 +≑ U+02251 +≒ U+02252 +≓ U+02253 +≔ U+02254 +≕ U+02255 +≖ U+02256 +≗ U+02257 +≙ U+02259 +≚ U+0225A +≜ U+0225C +≟ U+0225F +≠ U+02260 +≡ U+02261 +≢ U+02262 +≤ U+02264 +≥ U+02265 +≦ U+02266 +≧ U+02267 +≨ U+02268 +≩ U+02269 +≪ U+0226A +≫ U+0226B +≬ U+0226C +≭ U+0226D +≮ U+0226E +≯ U+0226F +≰ U+02270 +≱ U+02271 +≲ U+02272 +≳ U+02273 +≴ U+02274 +≵ U+02275 +≶ U+02276 +≷ U+02277 +≸ U+02278 +≹ U+02279 +≺ U+0227A +≻ U+0227B +≼ U+0227C +≽ U+0227D +≾ U+0227E +≿ U+0227F +⊀ U+02280 +⊁ U+02281 +⊂ U+02282 +⊃ U+02283 +⊄ U+02284 +⊅ U+02285 +⊆ U+02286 +⊇ U+02287 +⊈ U+02288 +⊉ U+02289 +⊊ U+0228A +⊋ U+0228B +⊍ U+0228D +⊎ U+0228E +⊏ U+0228F +⊐ U+02290 +⊑ U+02291 +⊒ U+02292 +⊓ U+02293 +⊔ U+02294 +⊕ U+02295 +⊖ U+02296 +⊗ U+02297 +⊘ U+02298 +⊙ U+02299 +⊚ U+0229A +⊛ U+0229B +⊝ U+0229D +⊞ U+0229E +⊟ U+0229F +⊠ U+022A0 +⊡ U+022A1 +⊢ U+022A2 +⊣ U+022A3 +⊤ U+022A4 +⊥ U+022A5 +⊧ U+022A7 +⊨ U+022A8 +⊩ U+022A9 +⊪ U+022AA +⊫ U+022AB +⊬ U+022AC +⊭ U+022AD +⊮ U+022AE +⊯ U+022AF +⊰ U+022B0 +⊲ U+022B2 +⊳ U+022B3 +⊴ U+022B4 +⊵ U+022B5 +⊶ U+022B6 +⊷ U+022B7 +⊸ U+022B8 +⊹ U+022B9 +⊺ U+022BA +⊻ U+022BB +⊽ U+022BD +⊾ U+022BE +⊿ U+022BF +⋀ U+022C0 +⋁ U+022C1 +⋂ U+022C2 +⋃ U+022C3 +⋄ U+022C4 +⋅ U+022C5 +⋆ U+022C6 +⋇ U+022C7 +⋈ U+022C8 +⋉ U+022C9 +⋊ U+022CA +⋋ U+022CB +⋌ U+022CC +⋍ U+022CD +⋎ U+022CE +⋏ U+022CF +⋐ U+022D0 +⋑ U+022D1 +⋒ U+022D2 +⋓ U+022D3 +⋔ U+022D4 +⋕ U+022D5 +⋖ U+022D6 +⋗ U+022D7 +⋘ U+022D8 +⋙ U+022D9 +⋚ U+022DA +⋛ U+022DB +⋞ U+022DE +⋟ U+022DF +⋠ U+022E0 +⋡ U+022E1 +⋢ U+022E2 +⋣ U+022E3 +⋦ U+022E6 +⋧ U+022E7 +⋨ U+022E8 +⋩ U+022E9 +⋪ U+022EA +⋫ U+022EB +⋬ U+022EC +⋭ U+022ED +⋮ U+022EE +⋯ U+022EF +⋰ U+022F0 +⋱ U+022F1 +⋲ U+022F2 +⋳ U+022F3 +⋴ U+022F4 +⋵ U+022F5 +⋶ U+022F6 +⋷ U+022F7 +⋹ U+022F9 +⋺ U+022FA +⋻ U+022FB +⋼ U+022FC +⋽ U+022FD +⋾ U+022FE +⌅ U+02305 +⌆ U+02306 +⌈ U+02308 +⌉ U+02309 +⌊ U+0230A +⌋ U+0230B +⌌ U+0230C +⌍ U+0230D +⌎ U+0230E +⌏ U+0230F +⌐ U+02310 +⌒ U+02312 +⌓ U+02313 +⌕ U+02315 +⌖ U+02316 +⌜ U+0231C +⌝ U+0231D +⌞ U+0231E +⌟ U+0231F +⌢ U+02322 +⌣ U+02323 +⌭ U+0232D +⌮ U+0232E +⌶ U+02336 +⌽ U+0233D +⌿ U+0233F +⍼ U+0237C +⎰ U+023B0 +⎱ U+023B1 +⎴ U+023B4 +⎵ U+023B5 +⎶ U+023B6 +⏜ U+023DC +⏝ U+023DD +⏞ U+023DE +⏟ U+023DF +⏢ U+023E2 +⏧ U+023E7 +␣ U+02423 +Ⓢ U+024C8 +─ U+02500 +│ U+02502 +┌ U+0250C +┐ U+02510 +└ U+02514 +┘ U+02518 +├ U+0251C +┤ U+02524 +┬ U+0252C +┴ U+02534 +┼ U+0253C +═ U+02550 +║ U+02551 +╒ U+02552 +╓ U+02553 +╔ U+02554 +╕ U+02555 +╖ U+02556 +╗ U+02557 +╘ U+02558 +╙ U+02559 +╚ U+0255A +╛ U+0255B +╜ U+0255C +╝ U+0255D +╞ U+0255E +╟ U+0255F +╠ U+02560 +╡ U+02561 +╢ U+02562 +╣ U+02563 +╤ U+02564 +╥ U+02565 +╦ U+02566 +╧ U+02567 +╨ U+02568 +╩ U+02569 +╪ U+0256A +╫ U+0256B +╬ U+0256C +▀ U+02580 +▄ U+02584 +█ U+02588 +░ U+02591 +▒ U+02592 +▓ U+02593 +□ U+025A1 +▪ U+025AA +▫ U+025AB +▭ U+025AD +▮ U+025AE +▱ U+025B1 +△ U+025B3 +▴ U+025B4 +▵ U+025B5 +▸ U+025B8 +▹ U+025B9 +▽ U+025BD +▾ U+025BE +▿ U+025BF +◂ U+025C2 +◃ U+025C3 +◊ U+025CA +○ U+025CB +◬ U+025EC +◯ U+025EF +◸ U+025F8 +◹ U+025F9 +◺ U+025FA +◻ U+025FB +◼ U+025FC +★ U+02605 +☆ U+02606 +☎ U+0260E +♀ U+02640 +♂ U+02642 +♠ U+02660 +♣ U+02663 +♥ U+02665 +♦ U+02666 +♪ U+0266A +♭ U+0266D +♮ U+0266E +♯ U+0266F +✓ U+02713 +✗ U+02717 +✠ U+02720 +✶ U+02736 +❘ U+02758 +❲ U+02772 +❳ U+02773 +⟈ U+027C8 +⟉ U+027C9 +⟦ U+027E6 +⟧ U+027E7 +⟨ U+027E8 +⟩ U+027E9 +⟪ U+027EA +⟫ U+027EB +⟬ U+027EC +⟭ U+027ED +⟵ U+027F5 +⟶ U+027F6 +⟷ U+027F7 +⟸ U+027F8 +⟹ U+027F9 +⟺ U+027FA +⟼ U+027FC +⟿ U+027FF +⤂ U+02902 +⤃ U+02903 +⤄ U+02904 +⤅ U+02905 +⤌ U+0290C +⤍ U+0290D +⤎ U+0290E +⤏ U+0290F +⤐ U+02910 +⤑ U+02911 +⤒ U+02912 +⤓ U+02913 +⤖ U+02916 +⤙ U+02919 +⤚ U+0291A +⤛ U+0291B +⤜ U+0291C +⤝ U+0291D +⤞ U+0291E +⤟ U+0291F +⤠ U+02920 +⤣ U+02923 +⤤ U+02924 +⤥ U+02925 +⤦ U+02926 +⤧ U+02927 +⤨ U+02928 +⤩ U+02929 +⤪ U+0292A +⤳ U+02933 +⤵ U+02935 +⤶ U+02936 +⤷ U+02937 +⤸ U+02938 +⤹ U+02939 +⤼ U+0293C +⤽ U+0293D +⥅ U+02945 +⥈ U+02948 +⥉ U+02949 +⥊ U+0294A +⥋ U+0294B +⥎ U+0294E +⥏ U+0294F +⥐ U+02950 +⥑ U+02951 +⥒ U+02952 +⥓ U+02953 +⥔ U+02954 +⥕ U+02955 +⥖ U+02956 +⥗ U+02957 +⥘ U+02958 +⥙ U+02959 +⥚ U+0295A +⥛ U+0295B +⥜ U+0295C +⥝ U+0295D +⥞ U+0295E +⥟ U+0295F +⥠ U+02960 +⥡ U+02961 +⥢ U+02962 +⥣ U+02963 +⥤ U+02964 +⥥ U+02965 +⥦ U+02966 +⥧ U+02967 +⥨ U+02968 +⥩ U+02969 +⥪ U+0296A +⥫ U+0296B +⥬ U+0296C +⥭ U+0296D +⥮ U+0296E +⥯ U+0296F +⥰ U+02970 +⥱ U+02971 +⥲ U+02972 +⥳ U+02973 +⥴ U+02974 +⥵ U+02975 +⥶ U+02976 +⥸ U+02978 +⥹ U+02979 +⥻ U+0297B +⥼ U+0297C +⥽ U+0297D +⥾ U+0297E +⥿ U+0297F +⦅ U+02985 +⦆ U+02986 +⦋ U+0298B +⦌ U+0298C +⦍ U+0298D +⦎ U+0298E +⦏ U+0298F +⦐ U+02990 +⦑ U+02991 +⦒ U+02992 +⦓ U+02993 +⦔ U+02994 +⦕ U+02995 +⦖ U+02996 +⦚ U+0299A +⦜ U+0299C +⦝ U+0299D +⦤ U+029A4 +⦥ U+029A5 +⦦ U+029A6 +⦧ U+029A7 +⦨ U+029A8 +⦩ U+029A9 +⦪ U+029AA +⦫ U+029AB +⦬ U+029AC +⦭ U+029AD +⦮ U+029AE +⦯ U+029AF +⦰ U+029B0 +⦱ U+029B1 +⦲ U+029B2 +⦳ U+029B3 +⦴ U+029B4 +⦵ U+029B5 +⦶ U+029B6 +⦷ U+029B7 +⦹ U+029B9 +⦻ U+029BB +⦼ U+029BC +⦾ U+029BE +⦿ U+029BF +⧀ U+029C0 +⧁ U+029C1 +⧂ U+029C2 +⧃ U+029C3 +⧄ U+029C4 +⧅ U+029C5 +⧉ U+029C9 +⧍ U+029CD +⧎ U+029CE +⧏ U+029CF +⧐ U+029D0 +⧜ U+029DC +⧝ U+029DD +⧞ U+029DE +⧣ U+029E3 +⧤ U+029E4 +⧥ U+029E5 +⧫ U+029EB +⧴ U+029F4 +⧶ U+029F6 +⨀ U+02A00 +⨁ U+02A01 +⨂ U+02A02 +⨄ U+02A04 +⨆ U+02A06 +⨌ U+02A0C +⨍ U+02A0D +⨐ U+02A10 +⨑ U+02A11 +⨒ U+02A12 +⨓ U+02A13 +⨔ U+02A14 +⨕ U+02A15 +⨖ U+02A16 +⨗ U+02A17 +⨢ U+02A22 +⨣ U+02A23 +⨤ U+02A24 +⨥ U+02A25 +⨦ U+02A26 +⨧ U+02A27 +⨩ U+02A29 +⨪ U+02A2A +⨭ U+02A2D +⨮ U+02A2E +⨯ U+02A2F +⨰ U+02A30 +⨱ U+02A31 +⨳ U+02A33 +⨴ U+02A34 +⨵ U+02A35 +⨶ U+02A36 +⨷ U+02A37 +⨸ U+02A38 +⨹ U+02A39 +⨺ U+02A3A +⨻ U+02A3B +⨼ U+02A3C +⨿ U+02A3F +⩀ U+02A40 +⩂ U+02A42 +⩃ U+02A43 +⩄ U+02A44 +⩅ U+02A45 +⩆ U+02A46 +⩇ U+02A47 +⩈ U+02A48 +⩉ U+02A49 +⩊ U+02A4A +⩋ U+02A4B +⩌ U+02A4C +⩍ U+02A4D +⩐ U+02A50 +⩓ U+02A53 +⩔ U+02A54 +⩕ U+02A55 +⩖ U+02A56 +⩗ U+02A57 +⩘ U+02A58 +⩚ U+02A5A +⩛ U+02A5B +⩜ U+02A5C +⩝ U+02A5D +⩟ U+02A5F +⩦ U+02A66 +⩪ U+02A6A +⩭ U+02A6D +⩮ U+02A6E +⩯ U+02A6F +⩰ U+02A70 +⩱ U+02A71 +⩲ U+02A72 +⩳ U+02A73 +⩴ U+02A74 +⩵ U+02A75 +⩷ U+02A77 +⩸ U+02A78 +⩹ U+02A79 +⩺ U+02A7A +⩻ U+02A7B +⩼ U+02A7C +⩽ U+02A7D +⩾ U+02A7E +⩿ U+02A7F +⪀ U+02A80 +⪁ U+02A81 +⪂ U+02A82 +⪃ U+02A83 +⪄ U+02A84 +⪅ U+02A85 +⪆ U+02A86 +⪇ U+02A87 +⪈ U+02A88 +⪉ U+02A89 +⪊ U+02A8A +⪋ U+02A8B +⪌ U+02A8C +⪍ U+02A8D +⪎ U+02A8E +⪏ U+02A8F +⪐ U+02A90 +⪑ U+02A91 +⪒ U+02A92 +⪓ U+02A93 +⪔ U+02A94 +⪕ U+02A95 +⪖ U+02A96 +⪗ U+02A97 +⪘ U+02A98 +⪙ U+02A99 +⪚ U+02A9A +⪝ U+02A9D +⪞ U+02A9E +⪟ U+02A9F +⪠ U+02AA0 +⪡ U+02AA1 +⪢ U+02AA2 +⪤ U+02AA4 +⪥ U+02AA5 +⪦ U+02AA6 +⪧ U+02AA7 +⪨ U+02AA8 +⪩ U+02AA9 +⪪ U+02AAA +⪫ U+02AAB +⪬ U+02AAC +⪭ U+02AAD +⪮ U+02AAE +⪯ U+02AAF +⪰ U+02AB0 +⪳ U+02AB3 +⪴ U+02AB4 +⪵ U+02AB5 +⪶ U+02AB6 +⪷ U+02AB7 +⪸ U+02AB8 +⪹ U+02AB9 +⪺ U+02ABA +⪻ U+02ABB +⪼ U+02ABC +⪽ U+02ABD +⪾ U+02ABE +⪿ U+02ABF +⫀ U+02AC0 +⫁ U+02AC1 +⫂ U+02AC2 +⫃ U+02AC3 +⫄ U+02AC4 +⫅ U+02AC5 +⫆ U+02AC6 +⫇ U+02AC7 +⫈ U+02AC8 +⫋ U+02ACB +⫌ U+02ACC +⫏ U+02ACF +⫐ U+02AD0 +⫑ U+02AD1 +⫒ U+02AD2 +⫓ U+02AD3 +⫔ U+02AD4 +⫕ U+02AD5 +⫖ U+02AD6 +⫗ U+02AD7 +⫘ U+02AD8 +⫙ U+02AD9 +⫚ U+02ADA +⫛ U+02ADB +⫤ U+02AE4 +⫦ U+02AE6 +⫧ U+02AE7 +⫨ U+02AE8 +⫩ U+02AE9 +⫫ U+02AEB +⫬ U+02AEC +⫭ U+02AED +⫮ U+02AEE +⫯ U+02AEF +⫰ U+02AF0 +⫱ U+02AF1 +⫲ U+02AF2 +⫳ U+02AF3 +⫽ U+02AFD +ff U+0FB00 +fi U+0FB01 +fl U+0FB02 +ffi U+0FB03 +ffl U+0FB04 +𝒜 U+1D49C +𝒞 U+1D49E +𝒟 U+1D49F +𝒢 U+1D4A2 +𝒥 U+1D4A5 +𝒦 U+1D4A6 +𝒩 U+1D4A9 +𝒪 U+1D4AA +𝒫 U+1D4AB +𝒬 U+1D4AC +𝒮 U+1D4AE +𝒯 U+1D4AF +𝒰 U+1D4B0 +𝒱 U+1D4B1 +𝒲 U+1D4B2 +𝒳 U+1D4B3 +𝒴 U+1D4B4 +𝒵 U+1D4B5 +𝒶 U+1D4B6 +𝒷 U+1D4B7 +𝒸 U+1D4B8 +𝒹 U+1D4B9 +𝒻 U+1D4BB +𝒽 U+1D4BD +𝒾 U+1D4BE +𝒿 U+1D4BF +𝓀 U+1D4C0 +𝓁 U+1D4C1 +𝓂 U+1D4C2 +𝓃 U+1D4C3 +𝓅 U+1D4C5 +𝓆 U+1D4C6 +𝓇 U+1D4C7 +𝓈 U+1D4C8 +𝓉 U+1D4C9 +𝓊 U+1D4CA +𝓋 U+1D4CB +𝓌 U+1D4CC +𝓍 U+1D4CD +𝓎 U+1D4CE +𝓏 U+1D4CF +𝔄 U+1D504 +𝔅 U+1D505 +𝔇 U+1D507 +𝔈 U+1D508 +𝔉 U+1D509 +𝔊 U+1D50A +𝔍 U+1D50D +𝔎 U+1D50E +𝔏 U+1D50F +𝔐 U+1D510 +𝔑 U+1D511 +𝔒 U+1D512 +𝔓 U+1D513 +𝔔 U+1D514 +𝔖 U+1D516 +𝔗 U+1D517 +𝔘 U+1D518 +𝔙 U+1D519 +𝔚 U+1D51A +𝔛 U+1D51B +𝔜 U+1D51C +𝔞 U+1D51E +𝔟 U+1D51F +𝔠 U+1D520 +𝔡 U+1D521 +𝔢 U+1D522 +𝔣 U+1D523 +𝔤 U+1D524 +𝔥 U+1D525 +𝔦 U+1D526 +𝔧 U+1D527 +𝔨 U+1D528 +𝔩 U+1D529 +𝔪 U+1D52A +𝔫 U+1D52B +𝔬 U+1D52C +𝔭 U+1D52D +𝔮 U+1D52E +𝔯 U+1D52F +𝔰 U+1D530 +𝔱 U+1D531 +𝔲 U+1D532 +𝔳 U+1D533 +𝔴 U+1D534 +𝔵 U+1D535 +𝔶 U+1D536 +𝔷 U+1D537 +𝔸 U+1D538 +𝔹 U+1D539 +𝔻 U+1D53B +𝔼 U+1D53C +𝔽 U+1D53D +𝔾 U+1D53E +𝕀 U+1D540 +𝕁 U+1D541 +𝕂 U+1D542 +𝕃 U+1D543 +𝕄 U+1D544 +𝕆 U+1D546 +𝕊 U+1D54A +𝕋 U+1D54B +𝕌 U+1D54C +𝕍 U+1D54D +𝕎 U+1D54E +𝕏 U+1D54F +𝕐 U+1D550 +𝕒 U+1D552 +𝕓 U+1D553 +𝕔 U+1D554 +𝕕 U+1D555 +𝕖 U+1D556 +𝕗 U+1D557 +𝕘 U+1D558 +𝕙 U+1D559 +𝕚 U+1D55A +𝕛 U+1D55B +𝕜 U+1D55C +𝕝 U+1D55D +𝕞 U+1D55E +𝕟 U+1D55F +𝕠 U+1D560 +𝕡 U+1D561 +𝕢 U+1D562 +𝕣 U+1D563 +𝕤 U+1D564 +𝕥 U+1D565 +𝕦 U+1D566 +𝕧 U+1D567 +𝕨 U+1D568 +𝕩 U+1D569 +𝕪 U+1D56A +𝕫 U+1D56B +<⃒ U+0003C U+020D2 +=⃥ U+0003D U+020E5 +>⃒ U+0003E U+020D2 +fj U+00066 U+0006A +   U+0205F U+0200A +↝̸ U+0219D U+00338 +∂̸ U+02202 U+00338 +∠⃒ U+02220 U+020D2 +∩︀ U+02229 U+0FE00 +∪︀ U+0222A U+0FE00 +∼⃒ U+0223C U+020D2 +∽̱ U+0223D U+00331 +∾̳ U+0223E U+00333 +≂̸ U+02242 U+00338 +≋̸ U+0224B U+00338 +≍⃒ U+0224D U+020D2 +≎̸ U+0224E U+00338 +≏̸ U+0224F U+00338 +≐̸ U+02250 U+00338 +≡⃥ U+02261 U+020E5 +≤⃒ U+02264 U+020D2 +≥⃒ U+02265 U+020D2 +≦̸ U+02266 U+00338 +≧̸ U+02267 U+00338 +≨︀ U+02268 U+0FE00 +≩︀ U+02269 U+0FE00 +≪̸ U+0226A U+00338 +≪⃒ U+0226A U+020D2 +≫̸ U+0226B U+00338 +≫⃒ U+0226B U+020D2 +≿̸ U+0227F U+00338 +⊂⃒ U+02282 U+020D2 +⊃⃒ U+02283 U+020D2 +⊊︀ U+0228A U+0FE00 +⊋︀ U+0228B U+0FE00 +⊏̸ U+0228F U+00338 +⊐̸ U+02290 U+00338 +⊓︀ U+02293 U+0FE00 +⊔︀ U+02294 U+0FE00 +⊴⃒ U+022B4 U+020D2 +⊵⃒ U+022B5 U+020D2 +⋘̸ U+022D8 U+00338 +⋙̸ U+022D9 U+00338 +⋚︀ U+022DA U+0FE00 +⋛︀ U+022DB U+0FE00 +⋵̸ U+022F5 U+00338 +⋹̸ U+022F9 U+00338 +⤳̸ U+02933 U+00338 +⧏̸ U+029CF U+00338 +⧐̸ U+029D0 U+00338 +⩭̸ U+02A6D U+00338 +⩰̸ U+02A70 U+00338 +⩽̸ U+02A7D U+00338 +⩾̸ U+02A7E U+00338 +⪡̸ U+02AA1 U+00338 +⪢̸ U+02AA2 U+00338 +⪬︀ U+02AAC U+0FE00 +⪭︀ U+02AAD U+0FE00 +⪯̸ U+02AAF U+00338 +⪰̸ U+02AB0 U+00338 +⫅̸ U+02AC5 U+00338 +⫆̸ U+02AC6 U+00338 +⫋︀ U+02ACB U+0FE00 +⫌︀ U+02ACC U+0FE00 +⫽︀ U+02AFD U+0FE00 diff --git a/tests/std/strings/htmlspecialchars.phpt b/tests/std/strings/htmlspecialchars.phpt new file mode 100644 index 00000000..a7aeb31c --- /dev/null +++ b/tests/std/strings/htmlspecialchars.phpt @@ -0,0 +1,309 @@ +--TEST-- +Test htmlspecialchars() function +--FILE-- +", ENT_NOQUOTES, NULL) ); +var_dump( htmlspecialchars("
", ENT_QUOTES, NULL) ); +var_dump( htmlspecialchars("
", ENT_COMPAT, NULL) ); + +/* giving long string to check for proper memory re-allocation */ +echo "\n*** Checking a long string for proper memory allocation ***\n"; +var_dump( htmlspecialchars("
Testing

New file.


File WORKS!!!


End of file!!!

", ENT_QUOTES, 'iso-8859-1' ) ); + +/* Giving a normal string */ +echo "\n*** Testing a normal string with htmlspecialchars() ***\n"; +var_dump( htmlspecialchars("
Testing

New file.

", ENT_QUOTES, 'iso-8859-1' ) ); + +/* checking behavior of quote */ +echo "\n*** Testing htmlspecialchars() on a quote...\n"; +$str = "A 'quote' is bold"; +var_dump( htmlspecialchars($str) ); +var_dump( htmlspecialchars($str, ENT_QUOTES) ); +var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); +var_dump( htmlspecialchars($str, ENT_COMPAT) ); + +echo "Done\n"; +?> +--EXPECT-- +*** Retrieving htmlspecialchars for 256 characters *** +string(12) "636872283029" +string(12) "636872283129" +string(12) "636872283229" +string(12) "636872283329" +string(12) "636872283429" +string(12) "636872283529" +string(12) "636872283629" +string(12) "636872283729" +string(12) "636872283829" +string(12) "636872283929" +string(14) "63687228313029" +string(14) "63687228313129" +string(14) "63687228313229" +string(14) "63687228313329" +string(14) "63687228313429" +string(14) "63687228313529" +string(14) "63687228313629" +string(14) "63687228313729" +string(14) "63687228313829" +string(14) "63687228313929" +string(14) "63687228323029" +string(14) "63687228323129" +string(14) "63687228323229" +string(14) "63687228323329" +string(14) "63687228323429" +string(14) "63687228323529" +string(14) "63687228323629" +string(14) "63687228323729" +string(14) "63687228323829" +string(14) "63687228323929" +string(14) "63687228333029" +string(14) "63687228333129" +string(14) "63687228333229" +string(14) "63687228333329" +string(14) "63687228333429" +string(14) "63687228333529" +string(14) "63687228333629" +string(14) "63687228333729" +string(14) "63687228333829" +string(14) "63687228333929" +string(14) "63687228343029" +string(14) "63687228343129" +string(14) "63687228343229" +string(14) "63687228343329" +string(14) "63687228343429" +string(14) "63687228343529" +string(14) "63687228343629" +string(14) "63687228343729" +string(14) "63687228343829" +string(14) "63687228343929" +string(14) "63687228353029" +string(14) "63687228353129" +string(14) "63687228353229" +string(14) "63687228353329" +string(14) "63687228353429" +string(14) "63687228353529" +string(14) "63687228353629" +string(14) "63687228353729" +string(14) "63687228353829" +string(14) "63687228353929" +string(14) "63687228363029" +string(14) "63687228363129" +string(14) "63687228363229" +string(14) "63687228363329" +string(14) "63687228363429" +string(14) "63687228363529" +string(14) "63687228363629" +string(14) "63687228363729" +string(14) "63687228363829" +string(14) "63687228363929" +string(14) "63687228373029" +string(14) "63687228373129" +string(14) "63687228373229" +string(14) "63687228373329" +string(14) "63687228373429" +string(14) "63687228373529" +string(14) "63687228373629" +string(14) "63687228373729" +string(14) "63687228373829" +string(14) "63687228373929" +string(14) "63687228383029" +string(14) "63687228383129" +string(14) "63687228383229" +string(14) "63687228383329" +string(14) "63687228383429" +string(14) "63687228383529" +string(14) "63687228383629" +string(14) "63687228383729" +string(14) "63687228383829" +string(14) "63687228383929" +string(14) "63687228393029" +string(14) "63687228393129" +string(14) "63687228393229" +string(14) "63687228393329" +string(14) "63687228393429" +string(14) "63687228393529" +string(14) "63687228393629" +string(14) "63687228393729" +string(14) "63687228393829" +string(14) "63687228393929" +string(16) "6368722831303029" +string(16) "6368722831303129" +string(16) "6368722831303229" +string(16) "6368722831303329" +string(16) "6368722831303429" +string(16) "6368722831303529" +string(16) "6368722831303629" +string(16) "6368722831303729" +string(16) "6368722831303829" +string(16) "6368722831303929" +string(16) "6368722831313029" +string(16) "6368722831313129" +string(16) "6368722831313229" +string(16) "6368722831313329" +string(16) "6368722831313429" +string(16) "6368722831313529" +string(16) "6368722831313629" +string(16) "6368722831313729" +string(16) "6368722831313829" +string(16) "6368722831313929" +string(16) "6368722831323029" +string(16) "6368722831323129" +string(16) "6368722831323229" +string(16) "6368722831323329" +string(16) "6368722831323429" +string(16) "6368722831323529" +string(16) "6368722831323629" +string(16) "6368722831323729" +string(16) "6368722831323829" +string(16) "6368722831323929" +string(16) "6368722831333029" +string(16) "6368722831333129" +string(16) "6368722831333229" +string(16) "6368722831333329" +string(16) "6368722831333429" +string(16) "6368722831333529" +string(16) "6368722831333629" +string(16) "6368722831333729" +string(16) "6368722831333829" +string(16) "6368722831333929" +string(16) "6368722831343029" +string(16) "6368722831343129" +string(16) "6368722831343229" +string(16) "6368722831343329" +string(16) "6368722831343429" +string(16) "6368722831343529" +string(16) "6368722831343629" +string(16) "6368722831343729" +string(16) "6368722831343829" +string(16) "6368722831343929" +string(16) "6368722831353029" +string(16) "6368722831353129" +string(16) "6368722831353229" +string(16) "6368722831353329" +string(16) "6368722831353429" +string(16) "6368722831353529" +string(16) "6368722831353629" +string(16) "6368722831353729" +string(16) "6368722831353829" +string(16) "6368722831353929" +string(16) "6368722831363029" +string(16) "6368722831363129" +string(16) "6368722831363229" +string(16) "6368722831363329" +string(16) "6368722831363429" +string(16) "6368722831363529" +string(16) "6368722831363629" +string(16) "6368722831363729" +string(16) "6368722831363829" +string(16) "6368722831363929" +string(16) "6368722831373029" +string(16) "6368722831373129" +string(16) "6368722831373229" +string(16) "6368722831373329" +string(16) "6368722831373429" +string(16) "6368722831373529" +string(16) "6368722831373629" +string(16) "6368722831373729" +string(16) "6368722831373829" +string(16) "6368722831373929" +string(16) "6368722831383029" +string(16) "6368722831383129" +string(16) "6368722831383229" +string(16) "6368722831383329" +string(16) "6368722831383429" +string(16) "6368722831383529" +string(16) "6368722831383629" +string(16) "6368722831383729" +string(16) "6368722831383829" +string(16) "6368722831383929" +string(16) "6368722831393029" +string(16) "6368722831393129" +string(16) "6368722831393229" +string(16) "6368722831393329" +string(16) "6368722831393429" +string(16) "6368722831393529" +string(16) "6368722831393629" +string(16) "6368722831393729" +string(16) "6368722831393829" +string(16) "6368722831393929" +string(16) "6368722832303029" +string(16) "6368722832303129" +string(16) "6368722832303229" +string(16) "6368722832303329" +string(16) "6368722832303429" +string(16) "6368722832303529" +string(16) "6368722832303629" +string(16) "6368722832303729" +string(16) "6368722832303829" +string(16) "6368722832303929" +string(16) "6368722832313029" +string(16) "6368722832313129" +string(16) "6368722832313229" +string(16) "6368722832313329" +string(16) "6368722832313429" +string(16) "6368722832313529" +string(16) "6368722832313629" +string(16) "6368722832313729" +string(16) "6368722832313829" +string(16) "6368722832313929" +string(16) "6368722832323029" +string(16) "6368722832323129" +string(16) "6368722832323229" +string(16) "6368722832323329" +string(16) "6368722832323429" +string(16) "6368722832323529" +string(16) "6368722832323629" +string(16) "6368722832323729" +string(16) "6368722832323829" +string(16) "6368722832323929" +string(16) "6368722832333029" +string(16) "6368722832333129" +string(16) "6368722832333229" +string(16) "6368722832333329" +string(16) "6368722832333429" +string(16) "6368722832333529" +string(16) "6368722832333629" +string(16) "6368722832333729" +string(16) "6368722832333829" +string(16) "6368722832333929" +string(16) "6368722832343029" +string(16) "6368722832343129" +string(16) "6368722832343229" +string(16) "6368722832343329" +string(16) "6368722832343429" +string(16) "6368722832343529" +string(16) "6368722832343629" +string(16) "6368722832343729" +string(16) "6368722832343829" +string(16) "6368722832343929" +string(16) "6368722832353029" +string(16) "6368722832353129" +string(16) "6368722832353229" +string(16) "6368722832353329" +string(16) "6368722832353429" +string(16) "6368722832353529" + +*** Testing htmlspecialchars() with NULL as first, second and third argument *** +string(10) "<br>" +string(10) "<br>" +string(10) "<br>" + +*** Checking a long string for proper memory allocation *** +string(187) "<br>Testing<p>New file.</p><p><br>File <b><i><u>WORKS!!!</i></u></b></p><br><p>End of file!!!</p>" + +*** Testing a normal string with htmlspecialchars() *** +string(46) "<br>Testing<p>New file.</p> " + +*** Testing htmlspecialchars() on a quote... +string(46) "A 'quote' is <b>bold</b>" +string(46) "A 'quote' is <b>bold</b>" +string(36) "A 'quote' is <b>bold</b>" +string(36) "A 'quote' is <b>bold</b>" +Done diff --git a/tests/std/strings/htmlspecialchars_basic.phpt b/tests/std/strings/htmlspecialchars_basic.phpt new file mode 100644 index 00000000..c86692aa --- /dev/null +++ b/tests/std/strings/htmlspecialchars_basic.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test htmlspecialchars() function : basic functionality +--FILE-- +\"&\n"; +$s2 = "&&abc<>\"&\n"; +$s3 = "a>,\\"&\n"; +$s4 = "a\'\'&bc<>\"&\n"; +$s5 = "&<\n"; +echo "Basic tests\n"; +echo "Test 1: " . htmlspecialchars ($s1); +echo "Test 2: " . htmlspecialchars ($s2); +echo "Test 3: " . htmlspecialchars ($s3); +echo "Test 4: " . htmlspecialchars ($s4); +echo "Test 5: " . htmlspecialchars ($s5); +echo "Test 6: " . htmlspecialchars ($s1,ENT_NOQUOTES); +echo "Test 7: " . htmlspecialchars ($s2,ENT_NOQUOTES); +echo "Test 8: " . htmlspecialchars ($s3,ENT_NOQUOTES); +echo "Test 9: " . htmlspecialchars ($s4,ENT_NOQUOTES); +echo "Test 10: " . htmlspecialchars ($s5,ENT_NOQUOTES); +echo "Test 11: " . htmlspecialchars ($s1,ENT_COMPAT); +echo "Test 12: " . htmlspecialchars ($s2,ENT_COMPAT); +echo "Test 13: " . htmlspecialchars ($s3,ENT_COMPAT); +echo "Test 14: " . htmlspecialchars ($s4,ENT_COMPAT); +echo "Test 15: " . htmlspecialchars ($s5,ENT_COMPAT); +echo "Test 16: " . htmlspecialchars ($s1,ENT_QUOTES); +echo "Test 17: " . htmlspecialchars ($s2,ENT_QUOTES); +echo "Test 18: " . htmlspecialchars ($s3,ENT_QUOTES); +echo "Test 19: " . htmlspecialchars ($s4,ENT_QUOTES); +echo "Test 20: " . htmlspecialchars ($s5,ENT_QUOTES); + +echo "\nTry with char set option - specify default ISO-8859-1\n"; +echo "Test 21: " . htmlspecialchars ($s1,ENT_NOQUOTES, "ISO-8859-1"); +echo "Test 22: " . htmlspecialchars ($s2,ENT_COMPAT, "ISO-8859-1"); +echo "Test 23: " . htmlspecialchars ($s3,ENT_QUOTES, "ISO-8859-1"); +echo "Test 24: " . htmlspecialchars ($s5,ENT_QUOTES, "ISO-8859-1"); + +echo "\nTry with double decode FALSE\n"; +$s1 = ""&xyz>abc"\n"; +$s2 = ""&123<456"\n"; +$s3 = "\"300 < 400\"\n"; +echo "Test 25: " . htmlspecialchars ($s1,ENT_NOQUOTES, "ISO-8859-1", false); +echo "Test 26: " . htmlspecialchars ($s2,ENT_NOQUOTES, "ISO-8859-1", false); +echo "Test 27: " . htmlspecialchars ($s3,ENT_NOQUOTES, "ISO-8859-1", false); + +echo "\nTry with double decode TRUE\n"; +echo "Test 28: " . htmlspecialchars ($s1, ENT_NOQUOTES, "ISO-8859-1", true); +echo "Test 29: " . htmlspecialchars ($s2, ENT_NOQUOTES, "ISO-8859-1", true); + +?> +--EXPECT-- +*** Testing htmlspecialchars() : basic functionality *** +Basic tests +Test 1: abc<>"& +Test 2: &&abc<>"& +Test 3: a>,\<bc<>"& +Test 4: a\'\'&bc<>"& +Test 5: &amp;&lt; +Test 6: abc<>"& +Test 7: &&abc<>"& +Test 8: a>,\<bc<>"& +Test 9: a\'\'&bc<>"& +Test 10: &amp;&lt; +Test 11: abc<>"& +Test 12: &&abc<>"& +Test 13: a>,\<bc<>"& +Test 14: a\'\'&bc<>"& +Test 15: &amp;&lt; +Test 16: abc<>"& +Test 17: &&abc<>"& +Test 18: a>,\<bc<>"& +Test 19: a\'\'&bc<>"& +Test 20: &amp;&lt; + +Try with char set option - specify default ISO-8859-1 +Test 21: abc<>"& +Test 22: &&abc<>"& +Test 23: a>,\<bc<>"& +Test 24: &amp;&lt; + +Try with double decode FALSE +Test 25: "&xyz>abc" +Test 26: "&123<456" +Test 27: "300 < 400" + +Try with double decode TRUE +Test 28: &quot;&amp;xyz&gt;abc&quot; +Test 29: &quot;&amp;123&lt;456&quot; diff --git a/tests/std/strings/htmlspecialchars_decode_basic.phpt b/tests/std/strings/htmlspecialchars_decode_basic.phpt new file mode 100644 index 00000000..ad9df68f --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test htmlspecialchars_decode() function : basic functionality +--FILE-- + Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string" +$single_quote_string = "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""; +$double_quote_string = "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""; + +// Calling htmlspecialchars_decode() with default arguments +var_dump( htmlspecialchars_decode($single_quote_string) ); +var_dump( htmlspecialchars_decode($double_quote_string) ); + +// Calling htmlspecialchars_decode() with optional 'quote_style' argument +var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) ); +var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) ); +var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) ); + +echo "Done"; +?> +--EXPECT-- +*** Testing htmlspecialchars_decode() : basic functionality *** +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +Done diff --git a/tests/std/strings/htmlspecialchars_decode_variation3.phpt b/tests/std/strings/htmlspecialchars_decode_variation3.phpt new file mode 100644 index 00000000..98d4684d --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_variation3.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - heredoc strings for 'string' argument +--FILE-- +Roy's height > Sam's height +13 < 25 +1111 & 0000 = 0000 +"This is a double quoted string" +EOT; + +// heredoc with different whitespaces +$diff_whitespaces = <<Roy's height\r > Sam\t's height +1111\t\t & 0000\v\v = \f0000 +" heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces" +EOT; + +// heredoc with numeric values +$numeric_string = <<11 < 12. 123 string 4567 +"string" 1111\t & 0000\t = 0000\n; +EOT; + +// heredoc with quote chars & slash +$quote_char_string = <<< This's a string with quotes: +"strings in double quote" & +'strings in single quote' " +this\line is 'single quoted' /with\slashes +EOT; + +$res_heredoc_strings = array( + //heredoc strings + $empty_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// loop through $res_heredoc_strings array and check the working on htmlspecialchars_decode() +$count = 1; +for($index =0; $index < count($res_heredoc_strings); $index ++) { + echo "-- Iteration $count --\n"; + var_dump( htmlspecialchars_decode($res_heredoc_strings[$index]) ); + $count++; +} + +echo "Done\n"; +?> +--EXPECT-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(93) "Roy's height > Sam's height +13 < 25 +1111 & 0000 = 0000 +"This is a double quoted string"" +-- Iteration 4 -- +string(120) "Roy's height > Sam 's height +1111 & 0000 = 0000 +" heredoc +double quoted string. with different white spaces"" +-- Iteration 5 -- +string(62) "11 < 12. 123 string 4567 +"string" 1111 & 0000 = 0000 +;" +-- Iteration 6 -- +string(143) "< This's a string with quotes: +"strings in double quote" & +'strings in single quote' " +this\line is 'single quoted' /with\slashes " +Done diff --git a/tests/std/strings/htmlspecialchars_decode_variation4.phpt b/tests/std/strings/htmlspecialchars_decode_variation4.phpt new file mode 100644 index 00000000..00d4e9a1 --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_variation4.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument +--FILE-- + +--EXPECT-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(100) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(98) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +-- Iteration 3 -- +string(38) "\nRoy's height >\t; Sam's\v height\f" +string(48) "\nRoy's height >\t; Sam's\v height\f" +string(48) "\nRoy's height >\t; Sam's\v height\f" +string(38) "\nRoy's height >\t; Sam's\v height\f" +-- Iteration 4 -- +string(38) "\r\tRoy's height >\r; Sam\t's height" +string(48) "\r\tRoy's height >\r; Sam\t's height" +string(48) "\r\tRoy's height >\r; Sam\t's height" +string(38) "\r\tRoy's height >\r; Sam\t's height" +-- Iteration 5 -- +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +Done diff --git a/tests/std/strings/htmlspecialchars_decode_variation5.phpt b/tests/std/strings/htmlspecialchars_decode_variation5.phpt new file mode 100644 index 00000000..3f235944 --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_variation5.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - double quoted strings for 'string' argument +--FILE-- + +--EXPECT-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(99) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +string(72) "Roy's height > Sam's height... 13 < 15... + " double quote string "" +string(82) "Roy's height > Sam's height... 13 < 15... + " double quote string "" +string(92) "Roy's height > Sam's height... 13 < 15... + " double quote string "" +string(72) "Roy's height > Sam's height... 13 < 15... + " double quote string "" +-- Iteration 3 -- +string(34) " +Roy's height > ; Sam's height " +string(44) " +Roy's height > ; Sam's height " +string(44) " +Roy's height > ; Sam's height " +string(34) " +Roy's height > ; Sam's height " +-- Iteration 4 -- +string(34) " Roy's height > ; Sam 's height" +string(44) " Roy's height > ; Sam 's height" +string(44) " Roy's height > ; Sam 's height" +string(34) " Roy's height > ; Sam 's height" +-- Iteration 5 -- +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +Done diff --git a/tests/std/strings/htmlspecialchars_decode_variation6.phpt b/tests/std/strings/htmlspecialchars_decode_variation6.phpt new file mode 100644 index 00000000..4539707c --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_variation6.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - binary safe +--FILE-- + +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(65) " Hello $world %0\&!)The big brown fox jumped over the lazy dog +" +-- Iteration 2 -- +string(42) " Hello "world" %0 This is a valid string" +-- Iteration 3 -- +string(51) "This converts decimal to $string1000001Hello world" +-- Iteration 4 -- +string(52) "5468697320697320612062696e61727909200b0c737472696e67" +Done diff --git a/tests/std/strings/htmlspecialchars_decode_variation7.phpt b/tests/std/strings/htmlspecialchars_decode_variation7.phpt new file mode 100644 index 00000000..20669b35 --- /dev/null +++ b/tests/std/strings/htmlspecialchars_decode_variation7.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - numerical entities for basic characters +--FILE-- + +--EXPECT-- +*** HTML 4.01/ENT_QUOTES *** +" DECODED +" DECODED +" DECODED +' NOT DECODED +' DECODED +' DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +*** XHTML 1.0/ENT_QUOTES *** +" DECODED +" DECODED +" DECODED +' DECODED +' DECODED +' DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +*** HTML5/ENT_QUOTES *** +" DECODED +" DECODED +" DECODED +' DECODED +' DECODED +' DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +*** XML 1.0/ENT_QUOTES *** +" DECODED +" DECODED +" DECODED +' DECODED +' DECODED +' DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +*** HTML5/ENT_NOQUOTES *** +" NOT DECODED +" NOT DECODED +" NOT DECODED +' NOT DECODED +' NOT DECODED +' NOT DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +*** HTML5/ENT_COMPAT *** +" DECODED +" DECODED +" DECODED +' NOT DECODED +' NOT DECODED +' NOT DECODED +& DECODED +& DECODED +< DECODED +> DECODED +< DECODED +< DECODED +< DECODED +> DECODED +> DECODED +? NOT DECODED + +Done. diff --git a/tests/std/strings/implode_basic.phpt b/tests/std/strings/implode_basic.phpt new file mode 100644 index 00000000..ee1dfe9c --- /dev/null +++ b/tests/std/strings/implode_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +implode() function +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +foobarbaz +foo:bar:baz + +Warning: Array to string conversion in %s on line %d +foo:Array:burp diff --git a/tests/std/strings/implode_error.phpt b/tests/std/strings/implode_error.phpt new file mode 100644 index 00000000..c590bcee --- /dev/null +++ b/tests/std/strings/implode_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test implode() function: error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +/* NULL as pieces */ +try { + var_dump(implode("glue", NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +/* integer as glue */ +try { + var_dump(implode(12, "pieces")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +implode(): Argument #2 ($array) must be of type ?array, string given diff --git a/tests/std/strings/implode_variation.phpt b/tests/std/strings/implode_variation.phpt new file mode 100644 index 00000000..f685dc28 --- /dev/null +++ b/tests/std/strings/implode_variation.phpt @@ -0,0 +1,233 @@ +--TEST-- +Test implode() function +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } + $counter++; +} + +/* empty string */ +echo "\n*** Testing implode() on empty string ***\n"; +try { + implode(""); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +/* checking sub-arrays */ +echo "\n*** Testing implode() on sub-arrays ***\n"; +$sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50); +var_dump(implode("TEST", $sub_array)); +try { + var_dump(implode(array(1, 2, 3, 4), $sub_array)); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} +try { + var_dump(implode(2, $sub_array)); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "\n*** Testing implode() on objects ***\n"; +/* checking on objects */ +class foo +{ + function __toString() { + return "Object"; + } +} + +$obj = new foo(); //creating new object +$arr = array(); +$arr[0] = &$obj; +$arr[1] = &$obj; +var_dump(implode(",", $arr)); +var_dump($arr); + +/* Checking on resource types */ +echo "\n*** Testing end() on resource type ***\n"; +/* file type resource */ +$file_handle = fopen(__FILE__, "r"); + +/* directory type resource */ +$dir_handle = opendir( __DIR__ ); + +/* store resources in array for comparison */ +$resources = array($file_handle, $dir_handle); + +var_dump(implode("::", $resources)); + +/* closing resource handles */ +fclose($file_handle); +closedir($dir_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing implode() for basic operations *** +string(4) "1, 2" +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +string(8) "1.1, 2.2" +array(2) { + [0]=> + float(1.1) + [1]=> + float(2.2) +} + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +string(12) "Array, Array" +array(2) { + [0]=> + array(1) { + [0]=> + int(2) + } + [1]=> + array(1) { + [0]=> + int(1) + } +} +string(3) ", 1" +array(2) { + [0]=> + bool(false) + [1]=> + bool(true) +} +string(0) "" +array(0) { +} +string(42) "a, aaaa, b, bbbb, c, ccccccccccccccccccccc" +array(6) { + [0]=> + string(1) "a" + [1]=> + string(4) "aaaa" + [2]=> + string(1) "b" + [3]=> + string(4) "bbbb" + [4]=> + string(1) "c" + [5]=> + string(21) "ccccccccccccccccccccc" +} +string(0) "" +array(1) { + [0]=> + NULL +} + +*** Testing implode() with variations of glue *** +-- Iteration 1 -- +string(59) "2TRUE0TRUE-639TRUE1TRUEPHPTRUETRUETRUE TRUEstring%0with%0...%0" +-- Iteration 2 -- +string(35) "2101-639111PHP111 1string%0with%0...%0" +-- Iteration 3 -- +string(27) "20-6391PHP string%0with%0...%0" +-- Iteration 4 -- +implode(): Argument #1 ($separator) must be of type string, array given +-- Iteration 5 -- +string(27) "20-6391PHP string%0with%0...%0" +-- Iteration 6 -- +string(35) "2 0 -639 1 PHP string%0with%0...%0" +-- Iteration 7 -- +string(139) "2string%0between0string%0between-639string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0betweenstring%0with%0...%0" +-- Iteration 8 -- +string(35) "2000-639010PHP000 0string%0with%0...%0" +-- Iteration 9 -- +string(43) "2\00\0-639\01\0PHP\0\0\0 \0string%0with%0...%0" + +*** Testing implode() on empty string *** +implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given + +*** Testing implode() on sub-arrays *** + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +string(27) "ArrayTESTArrayTESTPHPTEST50" +implode(): Argument #1 ($separator) must be of type string, array given + +Warning: Array to string conversion in %s + +Warning: Array to string conversion in %s +string(18) "Array2Array2PHP250" + +*** Testing implode() on objects *** +string(13) "Object,Object" +array(2) { + [0]=> + &object(foo)#%d (0) { + } + [1]=> + &object(foo)#%d (0) { + } +} + +*** Testing end() on resource type *** +string(%d) "Resource id #%d::Resource id #%d" +Done diff --git a/tests/std/strings/join_basic.phpt b/tests/std/strings/join_basic.phpt new file mode 100644 index 00000000..129f75bc --- /dev/null +++ b/tests/std/strings/join_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test join() function : basic functionality +--FILE-- + 10, "Minute" => 20, "Second" => 40); +$glue = ':'; +var_dump( join($glue, $pieces) ); + +// pieces as associative array (string/numeric values) +$pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007); +$glue = '/'; +var_dump( join($glue, $pieces) ); + +echo "Done\n"; +?> +--EXPECT-- +*** Testing join() : basic functionality *** +string(7) "1,2,3,4" +string(30) "Red, Green, Blue, Black, White" +string(8) "10:20:40" +string(21) "Friday/September/2007" +Done diff --git a/tests/std/strings/join_error.phpt b/tests/std/strings/join_error.phpt new file mode 100644 index 00000000..46ebe759 --- /dev/null +++ b/tests/std/strings/join_error.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test join() function: error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +echo "Done\n"; +?> +--EXPECT-- +*** Testing join() : error conditions *** + +-- Testing join() with less than expected no. of arguments -- +join(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +Done diff --git a/tests/std/strings/join_error1.phpt b/tests/std/strings/join_error1.phpt new file mode 100644 index 00000000..4b597707 --- /dev/null +++ b/tests/std/strings/join_error1.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test join() function : usage variations - unexpected values for 'pieces' argument(Bug#42789) +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } + + $counter ++; +} + +// close the resources used +fclose($fp); + +echo "Done\n"; +?> +--EXPECT-- +*** Testing join() : usage variations *** + +--- Testing join() by supplying different values for 'pieces' argument --- +-- Iteration 1 -- +join(): Argument #2 ($array) must be of type ?array, int given +-- Iteration 2 -- +join(): Argument #2 ($array) must be of type ?array, int given +-- Iteration 3 -- +join(): Argument #2 ($array) must be of type ?array, int given +-- Iteration 4 -- +join(): Argument #2 ($array) must be of type ?array, int given +-- Iteration 5 -- +join(): Argument #2 ($array) must be of type ?array, float given +-- Iteration 6 -- +join(): Argument #2 ($array) must be of type ?array, float given +-- Iteration 7 -- +join(): Argument #2 ($array) must be of type ?array, float given +-- Iteration 8 -- +join(): Argument #2 ($array) must be of type ?array, float given +-- Iteration 9 -- +join(): Argument #2 ($array) must be of type ?array, float given +-- Iteration 10 -- +join(): Argument #2 ($array) must be of type ?array, true given +-- Iteration 11 -- +join(): Argument #2 ($array) must be of type ?array, false given +-- Iteration 12 -- +join(): Argument #2 ($array) must be of type ?array, true given +-- Iteration 13 -- +join(): Argument #2 ($array) must be of type ?array, false given +-- Iteration 14 -- +join(): Argument #2 ($array) must be of type ?array, string given +-- Iteration 15 -- +join(): Argument #2 ($array) must be of type ?array, string given +-- Iteration 16 -- +join(): Argument #2 ($array) must be of type ?array, test given +-- Iteration 17 -- +join(): Argument #2 ($array) must be of type ?array, string given +-- Iteration 18 -- +join(): Argument #2 ($array) must be of type ?array, string given +-- Iteration 19 -- +join(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +-- Iteration 20 -- +join(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +-- Iteration 21 -- +join(): Argument #2 ($array) must be of type ?array, resource given +-- Iteration 22 -- +join(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +-- Iteration 23 -- +join(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given +Done diff --git a/tests/std/strings/join_variation1.phpt b/tests/std/strings/join_variation1.phpt new file mode 100644 index 00000000..215a0e87 --- /dev/null +++ b/tests/std/strings/join_variation1.phpt @@ -0,0 +1,137 @@ +--TEST-- +Test join() function : usage variations - unexpected values for 'glue' argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new test(), + + // empty string + "", + '', + + // resource variable + $fp, +); + + +// loop through each element of the array and check the working of join() +// when $glue argument is supplied with different values +echo "\n--- Testing join() by supplying different values for 'glue' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $glue = $values [$index]; + + try { + var_dump(join($glue, $pieces)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + + $counter++; +} + +echo "Done\n"; +?> +--EXPECT-- +*** Testing join() : usage variations *** + +--- Testing join() by supplying different values for 'glue' argument --- +-- Iteration 1 -- +string(17) "element10element2" +-- Iteration 2 -- +string(17) "element11element2" +-- Iteration 3 -- +string(21) "element112345element2" +-- Iteration 4 -- +string(21) "element1-2345element2" +-- Iteration 5 -- +string(20) "element110.5element2" +-- Iteration 6 -- +string(21) "element1-10.5element2" +-- Iteration 7 -- +string(28) "element1101234567000element2" +-- Iteration 8 -- +string(29) "element11.07654321E-9element2" +-- Iteration 9 -- +string(19) "element10.5element2" +-- Iteration 10 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 11 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 12 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 13 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 14 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 15 -- +string(17) "element11element2" +-- Iteration 16 -- +string(16) "element1element2" +-- Iteration 17 -- +string(17) "element11element2" +-- Iteration 18 -- +string(16) "element1element2" +-- Iteration 19 -- +string(26) "element1testObjectelement2" +-- Iteration 20 -- +string(16) "element1element2" +-- Iteration 21 -- +string(16) "element1element2" +-- Iteration 22 -- +join(): Argument #1 ($separator) must be of type array|string, resource given +Done diff --git a/tests/std/strings/join_variation3.phpt b/tests/std/strings/join_variation3.phpt new file mode 100644 index 00000000..506de5b6 --- /dev/null +++ b/tests/std/strings/join_variation3.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test join() function : usage variations - different values for 'pieces' argument +--SKIPIF-- + +--FILE-- + "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing empty/boolean values as key/value + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 5 => false, 6 => true), + array('' => 1, "" => 2, false => 5, true => 6), + + // array with repetitive keys + array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// a multichar glue value +$glue = "], ["; + +// loop through each $pieces_arrays element and call join() +$iteration = 1; +for($index = 0; $index < count($pieces_arrays); $index ++) { + echo "-- Iteration $iteration --\n"; + var_dump( join($glue, $pieces_arrays[$index]) ); + $iteration ++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing join() : usage variations *** +-- Iteration 1 -- +string(6) "1], [2" +-- Iteration 2 -- +string(10) "1.1], [2.2" +-- Iteration 3 -- + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +string(14) "Array], [Array" +-- Iteration 4 -- +string(5) "], [1" +-- Iteration 5 -- +string(0) "" +-- Iteration 6 -- +string(0) "" +-- Iteration 7 -- +string(36) "a], [aaaa], [b], [bbbb], [c], [ccccc" +-- Iteration 8 -- +string(19) "one], [two], [three" +-- Iteration 9 -- +string(11) "1], [2], [3" +-- Iteration 10 -- +string(20) "10], [20], [40], [30" +-- Iteration 11 -- +string(23) "ten], [twenty], [thirty" +-- Iteration 12 -- +string(16) "1], [two], [four" +-- Iteration 13 -- +string(22) "true], [false], [], [1" +-- Iteration 14 -- +string(14) "emptys], [], [" +-- Iteration 15 -- +string(13) "], [], [], [1" +-- Iteration 16 -- +string(11) "2], [5], [6" +-- Iteration 17 -- +string(13) "10], [20], [3" +Done diff --git a/tests/std/strings/join_variation4.phpt b/tests/std/strings/join_variation4.phpt new file mode 100644 index 00000000..6c53b402 --- /dev/null +++ b/tests/std/strings/join_variation4.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test join() function : usage variations - different values for 'glue' argument +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } + $counter++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing join() : usage variations *** +-- Iteration 1 -- +string(87) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUE TRUE6999.99999999TRUEstring%0with%0...%0" +-- Iteration 2 -- +string(57) "2101-6391-1.3444111PHP111 16999.999999991string%0with%0...%0" +-- Iteration 3 -- +string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" +-- Iteration 4 -- +join(): Argument #1 ($separator) must be of type string, array given +-- Iteration 5 -- +string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" +-- Iteration 6 -- +string(57) "2 0 -639 -1.3444 1 PHP 6999.99999999 string%0with%0...%0" +-- Iteration 7 -- +string(187) "2string%0between0string%0between-639string%0between-1.3444string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0between6999.99999999string%0betweenstring%0with%0...%0" +-- Iteration 8 -- +string(117) "2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666 -1.56666999.99999999-1.5666string%0with%0...%0" +-- Iteration 9 -- +string(57) "2000-6390-1.3444010PHP000 06999.999999990string%0with%0...%0" +-- Iteration 10 -- +string(67) "2\00\0-639\0-1.3444\01\0PHP\0\0\0 \06999.99999999\0string%0with%0...%0" +Done diff --git a/tests/std/strings/join_variation5.phpt b/tests/std/strings/join_variation5.phpt new file mode 100644 index 00000000..6324c1d0 --- /dev/null +++ b/tests/std/strings/join_variation5.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test join() function : usage variations - sub array as argument +--SKIPIF-- + +--FILE-- + "one", 2 => "two"), "PHP", 50); + +// pieces as array containing sub array +var_dump(join("TEST", $sub_array)); + +// glue as array & pieces as array containing sub array +try { + var_dump(join(array(1, 2, 3, 4), $sub_array)); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} + +// numeric value as glue, pieces as array containing sub array +var_dump(join(2, $sub_array)); + +// using directly the sub_array as pieces +var_dump(join(", ", $sub_array[0])); +var_dump(join(", ", $sub_array[1])); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing implode() : usage variations - sub arrays *** + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +string(27) "ArrayTESTArrayTESTPHPTEST50" +join(): Argument #1 ($separator) must be of type string, array given + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +string(18) "Array2Array2PHP250" +string(10) "1, 2, 3, 4" +string(8) "one, two" +Done diff --git a/tests/std/strings/join_variation6.phpt b/tests/std/strings/join_variation6.phpt new file mode 100644 index 00000000..44573274 --- /dev/null +++ b/tests/std/strings/join_variation6.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test join() function : usage variations - binary safe +--FILE-- + +--EXPECTF-- +*** Testing join() : usage variationsi - binary safe *** +string(23) "Red,%0 Green,%0 White,%0 1" +string(20) "Red, Green, White, 1" +Done diff --git a/tests/std/strings/lcfirst.phpt b/tests/std/strings/lcfirst.phpt new file mode 100644 index 00000000..f328dae2 --- /dev/null +++ b/tests/std/strings/lcfirst.phpt @@ -0,0 +1,203 @@ +--TEST-- +lcfirst() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + false); + + public function __call($m, $v) { + if (stristr($m, 'set')) { + $action = lcfirst(substr($m, 3)); + $this->$action = $v[0]; + } + } + + public function __set($key, $value) { + if (array_key_exists($key, $this->vars)) { + $this->vars[$key] = $value; + } + } + + public function __get($key) { + if (array_key_exists($key, $this->vars)) { + return $this->vars[$key]; + } + } +} + +$class = new Setter(); +$class->setPartnerName('partnerName'); +var_dump($class->partnerName); + +echo "\n--- Testing objects ---\n"; +/* we get "Recoverable fatal error: saying Object of class could not be converted + to string" by default when an object is passed instead of string: +The error can be avoided by choosing the __toString magix method as follows: */ + +class stringObject { + function __toString() { + return "Hello world"; + } +} +$obj_string = new stringObject; + +var_dump(lcfirst("$obj_string")); + + +echo "\n--- Testing a longer and heredoc string ---\n"; +$string = << +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +#### Basic and Various operations #### +string(16) "tesTing lcfirst." +string(17) "1.testing lcfirst" +string(11) "hELLO wORLD" +string(11) "hELLO wORLD" +string(1) "%0" +string(1) "%0" +string(2) "%00" +string(4) "abcd" +string(3) "xyz" +string(2) "-3" +string(2) "-3" +string(6) "-3.344" +string(6) "-3.344" +string(4) "nULL" +string(1) "0" +string(1) "0" +string(1) "1" +string(4) "tRUE" +string(1) "1" +string(1) "1" +string(8) "1.234444" +string(0) "" +string(5) "fALSE" +string(1) " " +string(5) " " +string(1) "b" +string(2) "\t" +string(1) " " +string(2) "12" +string(8) "12twelve" + +#### Testing miscellaneous inputs #### + +--- Testing lowercamelcase action call example --- +string(%d) "partnerName" + +--- Testing objects --- +string(11) "hello world" + +--- Testing a longer and heredoc string --- +string(639) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&* +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" + +--- Testing a heredoc null string --- +string(0) "" + +--- Testing simple and complex syntax strings --- +string(5) "world" +string(7) "world'S" + +Warning: Undefined variable $strS in %s on line %d +string(0) "" +string(6) "worldS" +string(6) "worldS" + +--- Nested lcfirst() --- +string(5) "hello" +Done diff --git a/tests/std/strings/levenshtein.phpt b/tests/std/strings/levenshtein.phpt new file mode 100644 index 00000000..41b559f8 --- /dev/null +++ b/tests/std/strings/levenshtein.phpt @@ -0,0 +1,63 @@ +--TEST-- +levenshtein() function test +--FILE-- + +--EXPECT-- +--- Equal --- +int(0) +--- First string empty --- +int(3) +--- Second string empty --- +int(3) +--- Both empty --- +int(0) +int(0) +--- 1 character --- +int(1) +--- 2 character swapped --- +int(2) +--- Inexpensive deletion --- +int(2) +--- Expensive deletion --- +int(10) +--- Inexpensive insertion --- +int(2) +--- Expensive insertion --- +int(10) +--- Expensive replacement --- +int(3) +--- Very expensive replacement --- +int(4) diff --git a/tests/std/strings/levenshtein_bug_16473.phpt b/tests/std/strings/levenshtein_bug_16473.phpt new file mode 100644 index 00000000..94c26508 --- /dev/null +++ b/tests/std/strings/levenshtein_bug_16473.phpt @@ -0,0 +1,16 @@ +--TEST-- +levenshtein() bug 16473 +--FILE-- + +--EXPECT-- +int(2) +int(2) +int(2) +int(2) diff --git a/tests/std/strings/levenshtein_bug_6562.phpt b/tests/std/strings/levenshtein_bug_6562.phpt new file mode 100644 index 00000000..31f07f47 --- /dev/null +++ b/tests/std/strings/levenshtein_bug_6562.phpt @@ -0,0 +1,16 @@ +--TEST-- +levenshtein() bug 6562 +--FILE-- + +--EXPECT-- +int(1) +int(1) +int(2) +int(1) diff --git a/tests/std/strings/levenshtein_bug_7368.phpt b/tests/std/strings/levenshtein_bug_7368.phpt new file mode 100644 index 00000000..ffbb7cd6 --- /dev/null +++ b/tests/std/strings/levenshtein_bug_7368.phpt @@ -0,0 +1,12 @@ +--TEST-- +levenshtein() bug 7368 +--FILE-- + +--EXPECT-- +int(2) +int(2) diff --git a/tests/std/strings/levenshtein_error_conditions.phpt b/tests/std/strings/levenshtein_error_conditions.phpt new file mode 100644 index 00000000..55e144b3 --- /dev/null +++ b/tests/std/strings/levenshtein_error_conditions.phpt @@ -0,0 +1,33 @@ +--TEST-- +levenshtein() former error conditions +--FILE-- +getMessage() . \PHP_EOL; +} +echo '--- String 2 ---' . \PHP_EOL; +var_dump(levenshtein('A', 'AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsu')); +try { + var_dump(levenshtein('A', 'AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuvwxyzAbcdefghijklmnopqrtsuv')); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} + +// TODO ValueError for negative costs? +// var_dump(levenshtein("", "", -1, -1, -1)); + +?> +--EXPECT-- +--- String 1 --- +int(254) +int(255) +--- String 2 --- +int(254) +int(255) diff --git a/tests/std/strings/locale_independent_float_to_string.phpt b/tests/std/strings/locale_independent_float_to_string.phpt new file mode 100644 index 00000000..ffcb6b86 --- /dev/null +++ b/tests/std/strings/locale_independent_float_to_string.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test that floats are converted to string locale independently +--SKIPIF-- + +--FILE-- + +--EXPECT-- +C locale: +- casting: +3.14 +3.14 +3.14 +- *printf functions: +3.14 +3.14 +3.14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: +3.14 +float(3.14) +float(3.14) +- other: +3.14 + +de_DE locale: +- casting: +3.14 +3.14 +3.14 +- *printf functions: +3,14 +3.14 +3,14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: +3.14 +float(3.14) +float(3.14) +- other: +3.14 diff --git a/tests/std/strings/ltrim.phpt b/tests/std/strings/ltrim.phpt new file mode 100644 index 00000000..952ad282 --- /dev/null +++ b/tests/std/strings/ltrim.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test ltrim() function +--FILE-- + +--EXPECT-- +*** Output for Error Conditions *** + + *** Using heredoc string *** +string(17) "ng heredoc string" + + *** Output for Normal Behaviour *** +string(10) "ltrim test" +string(13) " ltrim test" +string(18) " ltrim test" +string(10) "ltrim test" +string(11) " ltrim test" +string(10) "ltrim test" +string(10) "ltrim test" +string(10) "ltrim test" + + *** Output for scalar argument) *** +string(5) "12345" + +Done diff --git a/tests/std/strings/ltrim_basic.phpt b/tests/std/strings/ltrim_basic.phpt new file mode 100644 index 00000000..094ae223 --- /dev/null +++ b/tests/std/strings/ltrim_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test ltrim() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing ltrim() : basic functionality *** + +-- Trim string with all white space characters -- +string(29) "---These are a few words--- " + +-- Trim non-whitespace from a string -- +string(15) "Hello World===!" + +-- Trim some non-white space characters from a string -- +string(10) " World===!" + +-- Trim some non-white space characters from a string suing a character range -- +string(10) "0123456789" + +-- Trim the ASCII control characters at the beginning of a string -- +string(14) "Example string" diff --git a/tests/std/strings/ltrim_error.phpt b/tests/std/strings/ltrim_error.phpt new file mode 100644 index 00000000..42ae86eb --- /dev/null +++ b/tests/std/strings/ltrim_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test ltrim() function : error conditions +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing ltrim() : error conditions *** + +-- Test ltrim function with various invalid charlists + +Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range in %s on line %d +string(14) " Hello World +" diff --git a/tests/std/strings/md5.phpt b/tests/std/strings/md5.phpt new file mode 100644 index 00000000..32dba036 --- /dev/null +++ b/tests/std/strings/md5.phpt @@ -0,0 +1,20 @@ +--TEST-- +md5() with ASCII output +--FILE-- + +--EXPECT-- +d41d8cd98f00b204e9800998ecf8427e +0cc175b9c0f1b6a831c399e269772661 +900150983cd24fb0d6963f7d28e17f72 +f96b697d7cb7938d525a2f31aaf161d0 +c3fcd3d76192e4007dfb496cca67e13b +d174ab98d277d9f5a5611c2c9f419d9f +57edf4a22be3c955ac49da2e2107b67a diff --git a/tests/std/strings/md5_basic1.phpt b/tests/std/strings/md5_basic1.phpt new file mode 100644 index 00000000..d0af2371 --- /dev/null +++ b/tests/std/strings/md5_basic1.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test md5() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing md5() : basic functionality *** +string(32) "1f3870be274f6c49b3e31a0c6728957f" diff --git a/tests/std/strings/md5_basic2.phpt b/tests/std/strings/md5_basic2.phpt new file mode 100644 index 00000000..a7920648 --- /dev/null +++ b/tests/std/strings/md5_basic2.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test md5() function : basic functionality - with raw output +--FILE-- + +--EXPECT-- +*** Testing md5() : basic functionality - with raw output*** +string(32) "b10a8db164e0754105b7a99be72e3fe5" +TEST PASSED diff --git a/tests/std/strings/md5_file.phpt b/tests/std/strings/md5_file.phpt new file mode 100644 index 00000000..17755634 --- /dev/null +++ b/tests/std/strings/md5_file.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test md5_file() function with ASCII output and raw binary output +--SKIPIF-- + +--FILE-- +getMessage() . \PHP_EOL; +} +/* invalid filename */ +var_dump( md5_file("aZrq16u") ); + +/* Scalar value as filename */ +var_dump( md5_file(12) ); + +/* Hexadecimal Output for Empty file as input */ +echo "\n*** Hexadecimal Output for Empty file as Argument ***\n"; +var_dump( md5_file("EmptyFileMD5.txt") ); + +/* Raw Binary Output for Empty file as input */ +echo "\n*** Raw Binary Output for Empty file as Argument ***\n"; +var_dump( md5_file("EmptyFileMD5.txt", true) ); + +/* Normal operation with hexadecimal output */ +echo "\n*** Hexadecimal Output for a valid file with some contents ***\n"; +var_dump( md5_file("DataFileMD5.txt") ); + +/* Normal operation with raw binary output */ +echo "\n*** Raw Binary Output for a valid file with some contents ***\n"; +var_dump ( md5_file("DataFileMD5.txt", true) ); + +// remove temp files +unlink("DataFileMD5.txt"); +unlink("EmptyFileMD5.txt"); + +echo "\nDone"; +?> +--EXPECTF-- +*** Testing for error conditions *** +Path must not be empty + +Warning: md5_file(aZrq16u): Failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: md5_file(12): Failed to open stream: No such file or directory in %s on line %d +bool(false) + +*** Hexadecimal Output for Empty file as Argument *** +string(32) "d41d8cd98f00b204e9800998ecf8427e" + +*** Raw Binary Output for Empty file as Argument *** +string(16) "ÔŒÙ%0²é€ ˜ìøB~" + +*** Hexadecimal Output for a valid file with some contents *** +string(32) "7f28ec647825e2a70bf67778472cd4a2" + +*** Raw Binary Output for a valid file with some contents *** +string(16) "(ìdx%â§ öwxG,Ô¢" + +Done diff --git a/tests/std/strings/md5raw.phpt b/tests/std/strings/md5raw.phpt new file mode 100644 index 00000000..8f71ea6d --- /dev/null +++ b/tests/std/strings/md5raw.phpt @@ -0,0 +1,20 @@ +--TEST-- +md5() with RAW output +--FILE-- + +--EXPECT-- +d41d8cd98f00b204e9800998ecf8427e +0cc175b9c0f1b6a831c399e269772661 +900150983cd24fb0d6963f7d28e17f72 +f96b697d7cb7938d525a2f31aaf161d0 +c3fcd3d76192e4007dfb496cca67e13b +d174ab98d277d9f5a5611c2c9f419d9f +57edf4a22be3c955ac49da2e2107b67a diff --git a/tests/std/strings/metaphone.phpt b/tests/std/strings/metaphone.phpt new file mode 100644 index 00000000..6b8f5c1c --- /dev/null +++ b/tests/std/strings/metaphone.phpt @@ -0,0 +1,40 @@ +--TEST-- +metaphone() tests +--FILE-- +getMessage(), "\n"; +} +var_dump(metaphone("valid phrase", 0)); +var_dump(metaphone("valid phrase", 10000)); + +$array = array( +"They fell forward, grovelling heedlessly on the cold earth.", +"But the shadow of horror wheeled and returned, passing lower now, right above them, sweeping the fen-reek with its ghastly wings.", +"And then it was gone, flying back to Mordor with the speed of the wrath of Sauron; and behind it the wind roared away, leaving the Dead Marshes bare and bleak.", +"The naked waste, as far as the eye could pierce, even to the distant menace of the mountains, was dappled with the fitful moonlight." +); + +foreach($array as $str) { + var_dump(metaphone($str)); +} + +echo "Done\n"; +?> +--EXPECT-- +string(0) "" +string(0) "" +metaphone(): Argument #2 ($max_phonemes) must be greater than or equal to 0 +string(6) "FLTFRS" +string(6) "FLTFRS" +string(26) "0FLFRWRTKRFLNKHTLSLN0KLTR0" +string(56) "BT0XTFHRRHLTNTRTRNTPSNKLWRNRFTBF0MSWPNK0FNRKW0TSFSTLWNKS" +string(69) "ANT0NTWSKNFLYNKBKTMRTRW00SPTF0R0FSRNNTBHNTT0WNTRRTWLFNK0TTMRXSBRNTBLK" +string(56) "0NKTWSTSFRS0YKLTPRSFNT0TSTNTMNSF0MNTNSWSTPLTW00FTFLMNLFT" +Done diff --git a/tests/std/strings/nl2br.phpt b/tests/std/strings/nl2br.phpt new file mode 100644 index 00000000..c90788fd --- /dev/null +++ b/tests/std/strings/nl2br.phpt @@ -0,0 +1,43 @@ +--TEST-- +nl2br() function +--FILE-- + +--EXPECT-- +string(4) "test" +string(0) "" +string(8) "
+" +string(7) "
+" +string(7) "
" +string(8) "
+ " +string(44) "
+
+



" +string(47) "
+
+
+
+
+
+" +string(66) "
+
+
+
+
+


+
" diff --git a/tests/std/strings/nl2br_variation1.phpt b/tests/std/strings/nl2br_variation1.phpt new file mode 100644 index 00000000..d7de19bf --- /dev/null +++ b/tests/std/strings/nl2br_variation1.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test nl2br() function : usage variations - double quoted strings for 'str' argument +--FILE-- + +--EXPECT-- +*** Testing nl2br() : usage variations *** +-- Iteration 1 -- +string(17) "Hello
+World" +-- Iteration 2 -- +string(31) "
+Hello
+World
+" +-- Iteration 3 -- +string(17) "Hello
World" +-- Iteration 4 -- +string(31) "
Hello
World
" +-- Iteration 5 -- +string(18) "Hello
+World" +-- Iteration 6 -- +string(34) "
+Hello
+World
+" +-- Iteration 7 -- +string(7) "
+" +-- Iteration 8 -- +string(14) "
+
+" +-- Iteration 9 -- +string(17) "Hello
+World" +Done diff --git a/tests/std/strings/nl2br_variation2.phpt b/tests/std/strings/nl2br_variation2.phpt new file mode 100644 index 00000000..88e97693 --- /dev/null +++ b/tests/std/strings/nl2br_variation2.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test nl2br() function : usage variations - single quoted strings for 'str' argument +--FILE-- + +--EXPECT-- +*** Testing nl2br() : usage variations *** +-- Iteration 1 -- +string(2) "\n" +-- Iteration 2 -- +string(2) "\r" +-- Iteration 3 -- +string(4) "\r\n" +-- Iteration 4 -- +string(12) "Hello\nWorld" +-- Iteration 5 -- +string(12) "Hello\rWorld" +-- Iteration 6 -- +string(14) "Hello\r\nWorld" +-- Iteration 7 -- +string(7) "
+" +-- Iteration 8 -- +string(14) "
+
+" +-- Iteration 9 -- +string(17) "Hello
+World" +Done diff --git a/tests/std/strings/nl2br_variation3.phpt b/tests/std/strings/nl2br_variation3.phpt new file mode 100644 index 00000000..e066a592 --- /dev/null +++ b/tests/std/strings/nl2br_variation3.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test nl2br() function : usage variations - heredoc strings for 'str' argument +--FILE-- + +--EXPECT-- +*** Testing nl2br() : usage variations *** +string(147) "
+
+
+
+
+
+nn
+
+
+n
+ rr


r
+
+
+
+
+r
n" +string(118) "Hello
+World
+This is es for
+
+ew lines
+like
+
+

+ and etc" +Done diff --git a/tests/std/strings/nl2br_variation4.phpt b/tests/std/strings/nl2br_variation4.phpt new file mode 100644 index 00000000..85d71315 --- /dev/null +++ b/tests/std/strings/nl2br_variation4.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test nl2br() function : usage variations - html values for 'str' argument +--FILE-- +Hello
world", + "
", + "\nHello\r\nworld\r", + "\n \r\n \r", +); + +//loop through $strings array to test nl2br() function with each element +foreach( $strings as $str ){ + var_dump(nl2br($str) ); +} +echo "Done"; +?> +--EXPECT-- +*** Testing nl2br() : usage variations *** +string(29) "Hello
world" +string(19) "
" +string(45) "
+Hello
+world
" +string(37) "
+
+
" +Done diff --git a/tests/std/strings/nl_langinfo_basic.phpt b/tests/std/strings/nl_langinfo_basic.phpt new file mode 100644 index 00000000..c0f6d7ef --- /dev/null +++ b/tests/std/strings/nl_langinfo_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test nl_langinfo() function : basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing nl_langinfo() : basic functionality *** +string(3) "Mon" +string(9) "Wednesday" +string(3) "Jul" +string(5) "April" +string(1) "." diff --git a/tests/std/strings/number_format_basic.phpt b/tests/std/strings/number_format_basic.phpt new file mode 100644 index 00000000..2e54eb1f --- /dev/null +++ b/tests/std/strings/number_format_basic.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test number_format() - basic function test number_format() +--FILE-- + +--EXPECT-- +*** Testing number_format() : basic functionality *** + +-- number_format tests.....default -- +string(5) "1,235" +string(6) "-1,235" +string(10) "12,346,578" +string(11) "-12,345,679" +string(11) "305,450,479" +string(11) "402,653,183" +string(11) "123,456,789" +string(3) "123" +string(3) "123" +string(1) "1" +string(1) "0" + +-- number_format tests.....with two dp -- +string(8) "1,234.57" +string(9) "-1,234.57" +string(13) "12,346,578.00" +string(14) "-12,345,678.90" +string(14) "305,450,479.00" +string(14) "402,653,183.00" +string(14) "123,456,789.00" +string(6) "123.46" +string(6) "123.46" +string(4) "1.00" +string(4) "0.00" + +-- number_format tests.....English format -- +string(8) "1 234.57" +string(9) "-1 234.57" +string(13) "12 346 578.00" +string(14) "-12 345 678.90" +string(14) "305 450 479.00" +string(14) "402 653 183.00" +string(14) "123 456 789.00" +string(6) "123.46" +string(6) "123.46" +string(4) "1.00" +string(4) "0.00" + +-- number_format tests.....French format -- +string(8) "1 234,57" +string(9) "-1 234,57" +string(13) "12 346 578,00" +string(14) "-12 345 678,90" +string(14) "305 450 479,00" +string(14) "402 653 183,00" +string(14) "123 456 789,00" +string(6) "123,46" +string(6) "123,46" +string(4) "1,00" +string(4) "0,00" diff --git a/tests/std/strings/ord_basic.phpt b/tests/std/strings/ord_basic.phpt new file mode 100644 index 00000000..4e00bd0b --- /dev/null +++ b/tests/std/strings/ord_basic.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test ord() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing ord() : basic functionality *** +int(97) +int(122) +int(48) +int(57) +int(33) +int(42) +int(64) +int(10) +int(10) +int(255) diff --git a/tests/std/strings/ord_not_1_byte.phpt b/tests/std/strings/ord_not_1_byte.phpt new file mode 100644 index 00000000..f08cf24d --- /dev/null +++ b/tests/std/strings/ord_not_1_byte.phpt @@ -0,0 +1,19 @@ +--TEST-- +ord() with values not one byte long +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Deprecated: ord(): Providing an empty string is deprecated in %s on line 3 +int(0) + +Deprecated: ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead in %s on line 4 +int(72) diff --git a/tests/std/strings/oss_fuzz_57392.phpt b/tests/std/strings/oss_fuzz_57392.phpt new file mode 100644 index 00000000..42e551d6 --- /dev/null +++ b/tests/std/strings/oss_fuzz_57392.phpt @@ -0,0 +1,18 @@ +--TEST-- +oss-fuzz #57392: Buffer-overflow in php_fgetcsv() with \0 delimiter and enclosure +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(12) "aaaaaaaaaaaa" + [1]=> + string(2) " " +} diff --git a/tests/std/strings/pack.phpt b/tests/std/strings/pack.phpt new file mode 100644 index 00000000..e71f9ce3 --- /dev/null +++ b/tests/std/strings/pack.phpt @@ -0,0 +1,405 @@ +--TEST-- +Generic pack()/unpack() tests +--SKIPIF-- + 2147483647) { + die("skip 32bit test only"); +} +?> +--FILE-- + +--EXPECTF-- +Array +( + [1] => h +) +Array +( + [1] => hello world +) +"hello " +Array +( + [1] => 129 +) +Array +( + [1] => 127 +) +Array +( + [1] => 255 +) +Array +( + [1] => 127 +) +Array +( + [1] => 4 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) +Array +( + [1] => -1000 +) +Array +( + [1] => -64434 +) + +Warning: The float 4294967296 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => 0 +) + +Warning: The float -4294967296 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => 0 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) + +Warning: The float 2147483650 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -2147483646 +) + +Warning: The float 4294967295 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -1 +) +Array +( + [1] => -2147483648 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) + +Warning: The float 2147483650 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -2147483646 +) + +Warning: The float 4294967296 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => 0 +) +Array +( + [1] => -2147483648 +) +Array +( + [1] => -30000 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 1 +) +Array +( + [1] => 0 +) +Array +( + [1] => 64536 +) +Array +( + [1] => 1102 +) +Array +( + [1] => 1 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) + +Warning: The float 2147483650 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -2147483646 +) + +Warning: The float 4294967296 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => 0 +) +Array +( + [1] => -2147483648 +) +Array +( + [1] => h +) +Array +( + [1] => hello world +) +Array +( + [1] => -127 +) +Array +( + [1] => 127 +) +Array +( + [1] => -1 +) +Array +( + [1] => 127 +) +Array +( + [1] => 3 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) +Array +( + [1] => -1000 +) +Array +( + [1] => -64434 +) +Array +( + [1] => -65535 +) +Array +( + [1] => -2147483647 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 0 +) + +Warning: The float 2147483650 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -2147483646 +) + +Warning: The float 4294967296 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => 0 +) +Array +( + [1] => -2147483648 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 1 +) +Array +( + [1] => 0 +) +Array +( + [1] => 64536 +) +Array +( + [1] => 1102 +) +Array +( + [1] => 1 +) +Array +( + [1] => 32767 +) +Array +( + [1] => -1 +) +Array +( + [1] => 0 +) +Array +( + [1] => -1000 +) +Array +( + [1] => 1102 +) +Array +( + [1] => 1 +) +Array +( + [1] => 65534 +) +Array +( + [1] => 1 +) +Array +( + [1] => 0 +) +Array +( + [1] => 64536 +) +Array +( + [1] => 1102 +) +Array +( + [1] => 1 +) diff --git a/tests/std/strings/pack64.phpt b/tests/std/strings/pack64.phpt new file mode 100644 index 00000000..b93769ce --- /dev/null +++ b/tests/std/strings/pack64.phpt @@ -0,0 +1,150 @@ +--TEST-- +64bit pack()/unpack() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Array +( + [1] => 281474976710654 +) +Array +( + [1] => 0 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => -1 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => 281474976710654 +) +Array +( + [1] => 0 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => -1 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => 281474976710654 +) +Array +( + [1] => 0 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => -1 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => 281474976710654 +) +Array +( + [1] => 0 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => -1 +) + +Warning: The float 9.223372036854776E+18 is not representable as an int, cast occurred in %s on line %d +Array +( + [1] => -9223372036854775808 +) +Array +( + [1] => 2147483647 +) +Array +( + [1] => -2147483647 +) +Array +( + [1] => -2147483648 +) +Array +( + [1] => 4294967295 +) diff --git a/tests/std/strings/pack64_32.phpt b/tests/std/strings/pack64_32.phpt new file mode 100644 index 00000000..10a7b94b --- /dev/null +++ b/tests/std/strings/pack64_32.phpt @@ -0,0 +1,62 @@ +--TEST-- +64bit pack()/unpack() tests +--SKIPIF-- + 4) { + die("skip 32bit test only"); +} +?> +--FILE-- +getMessage(), "\n"; +} +try { + var_dump(pack("J", 0)); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(pack("P", 0)); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(pack("q", 0)); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump(unpack("Q", '')); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unpack("J", '')); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unpack("P", '')); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(unpack("q", '')); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP +64-bit format codes are not available for 32-bit versions of PHP diff --git a/tests/std/strings/pack_A.phpt b/tests/std/strings/pack_A.phpt new file mode 100644 index 00000000..abc12ac1 --- /dev/null +++ b/tests/std/strings/pack_A.phpt @@ -0,0 +1,24 @@ +--TEST-- +pack()/unpack(): "A" modifier +--FILE-- + +--EXPECTF-- +string(5) "foo " +string(4) "fooo" +string(4) "foo " +array(1) { + [1]=> + string(8) "foo%c%cbar" +} +array(1) { + [1]=> + string(3) "foo" +} diff --git a/tests/std/strings/pack_Z.phpt b/tests/std/strings/pack_Z.phpt new file mode 100644 index 00000000..cd535ead --- /dev/null +++ b/tests/std/strings/pack_Z.phpt @@ -0,0 +1,55 @@ +--TEST-- +pack()/unpack(): "Z" format +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: unpack(): Type Z: not enough input values, need 2 values but only 1 was provided in %s on line %d +string(0) "" +string(5) "foo%c%c" +string(4) "foo%c" +string(4) "foo%c" +string(4) "foo%c" +array(1) { + [1]=> + string(3) "foo" +} +array(1) { + [1]=> + string(3) "foo" +} +bool(false) +array(1) { + [1]=> + string(0) "" +} +array(1) { + [1]=> + string(1) "A" +} +array(1) { + [1]=> + string(2) "AB" +} +array(1) { + [1]=> + string(2) "AB" +} diff --git a/tests/std/strings/pack_arrays.phpt b/tests/std/strings/pack_arrays.phpt new file mode 100644 index 00000000..30189700 --- /dev/null +++ b/tests/std/strings/pack_arrays.phpt @@ -0,0 +1,42 @@ +--TEST-- +test unpack() to array with named keys +--FILE-- + +--EXPECT-- +Array +( + [aa] => 66051 + [bb] => 67438087 + [cc] => 134810123 +) +Array +( + [aa1] => 66051 + [aa2] => 67438087 + [cc] => 134810123 +) +Array +( + [aa1] => 66051 + [aa2] => 67438087 + [aa3] => 134810123 +) +Array +( + [aa1] => 66051 + [aa2] => 67438087 + [aa3] => 134810123 +) +Array +( + [1] => 66051 + [2] => 67438087 + [3] => 134810123 +) diff --git a/tests/std/strings/pack_float.phpt b/tests/std/strings/pack_float.phpt new file mode 100644 index 00000000..50762550 --- /dev/null +++ b/tests/std/strings/pack_float.phpt @@ -0,0 +1,316 @@ +--TEST-- +pack()/unpack(): float/double tests +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(6) "pack e" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "000000000000f03f" +string(16) "000000000000f03f" +string(16) "0080e03779c34143" +string(16) "4a6ade0d65ebe23f" +string(16) "e1639d31956ae543" +string(16) "000000000000f0bf" +string(16) "000000000000f0bf" +string(16) "0080e03779c341c3" +string(16) "4a6ade0d65ebe2bf" +string(16) "e1639d31956ae5c3" +string(6) "pack E" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "0000000000000000" +string(16) "3ff0000000000000" +string(16) "3ff0000000000000" +string(16) "4341c37937e08000" +string(16) "3fe2eb650dde6a4a" +string(16) "43e56a95319d63e1" +string(16) "bff0000000000000" +string(16) "bff0000000000000" +string(16) "c341c37937e08000" +string(16) "bfe2eb650dde6a4a" +string(16) "c3e56a95319d63e1" +string(6) "pack g" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "0000803f" +string(8) "0000803f" +string(8) "ca1b0e5a" +string(8) "285b173f" +string(8) "aa542b5f" +string(8) "000080bf" +string(8) "000080bf" +string(8) "ca1b0eda" +string(8) "285b17bf" +string(8) "aa542bdf" +string(6) "pack G" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "00000000" +string(8) "3f800000" +string(8) "3f800000" +string(8) "5a0e1bca" +string(8) "3f175b28" +string(8) "5f2b54aa" +string(8) "bf800000" +string(8) "bf800000" +string(8) "da0e1bca" +string(8) "bf175b28" +string(8) "df2b54aa" +string(8) "unpack e" +array(1) { + [1]=> + float(0) +} +array(1) { + [1]=> + float(1) +} +array(1) { + [1]=> + float(10000000000000000) +} +array(1) { + [1]=> + float(0.591234709823149) +} +array(1) { + [1]=> + float(-1) +} +array(1) { + [1]=> + float(-10000000000000000) +} +array(1) { + [1]=> + float(-0.591234709823149) +} +array(1) { + [1]=> + float(-1.2345678901234567E+19) +} +string(8) "unpack E" +array(1) { + [1]=> + float(1) +} +array(1) { + [1]=> + float(10000000000000000) +} +array(1) { + [1]=> + float(0.591234709823149) +} +array(1) { + [1]=> + float(1.2345678901234567E+19) +} +array(1) { + [1]=> + float(-1) +} +array(1) { + [1]=> + float(-10000000000000000) +} +array(1) { + [1]=> + float(-0.591234709823149) +} +array(1) { + [1]=> + float(-1.2345678901234567E+19) +} +string(8) "unpack g" +array(1) { + [1]=> + float(1) +} +array(1) { + [1]=> + float(10000000272564224) +} +array(1) { + [1]=> + float(0.5912346839904785) +} +array(1) { + [1]=> + float(1.2345679395506094E+19) +} +array(1) { + [1]=> + float(-1) +} +array(1) { + [1]=> + float(-10000000272564224) +} +array(1) { + [1]=> + float(-0.5912346839904785) +} +array(1) { + [1]=> + float(-1.2345679395506094E+19) +} +string(8) "unpack G" +array(1) { + [1]=> + float(1) +} +array(1) { + [1]=> + float(10000000272564224) +} +array(1) { + [1]=> + float(0.5912346839904785) +} +array(1) { + [1]=> + float(1.2345679395506094E+19) +} +array(1) { + [1]=> + float(-1) +} +array(1) { + [1]=> + float(-10000000272564224) +} +array(1) { + [1]=> + float(-0.5912346839904785) +} +array(1) { + [1]=> + float(-1.2345679395506094E+19) +} diff --git a/tests/std/strings/parse_str_basic1.phpt b/tests/std/strings/parse_str_basic1.phpt new file mode 100644 index 00000000..c63b2273 --- /dev/null +++ b/tests/std/strings/parse_str_basic1.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test parse_str() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing parse_str() : basic functionality *** + +Basic test WITH undefined var for result arg +NULL +array(3) { + ["first"]=> + string(4) "val1" + ["second"]=> + string(4) "val2" + ["third"]=> + string(4) "val3" +} + +Basic test WITH existing non-array var for result arg +NULL +array(3) { + ["first"]=> + string(4) "val1" + ["second"]=> + string(4) "val2" + ["third"]=> + string(4) "val3" +} + +Basic test with an existing array as results array +NULL +array(3) { + ["first"]=> + string(4) "val1" + ["second"]=> + string(4) "val2" + ["third"]=> + string(4) "val3" +} diff --git a/tests/std/strings/parse_str_basic2.phpt b/tests/std/strings/parse_str_basic2.phpt new file mode 100644 index 00000000..8a928cc9 --- /dev/null +++ b/tests/std/strings/parse_str_basic2.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test parse_str() function : non-default arg_separator.input specified +--SKIPIF-- + +--INI-- +arg_separator.input = "/" +--FILE-- + +--EXPECT-- +*** Testing parse_str() : non-default arg_separator.input specified *** +NULL +array(3) { + ["first"]=> + string(4) "val1" + ["second"]=> + string(4) "val2" + ["third"]=> + string(4) "val3" +} diff --git a/tests/std/strings/parse_str_basic3.phpt b/tests/std/strings/parse_str_basic3.phpt new file mode 100644 index 00000000..387bf758 --- /dev/null +++ b/tests/std/strings/parse_str_basic3.phpt @@ -0,0 +1,229 @@ +--TEST-- +Test parse_str() function : basic functionality +--INI-- +max_input_vars=100 +filter.default=unsafe_raw +--FILE-- + +--EXPECTF-- +*** Testing parse_str() : basic functionality *** + +Test string with array values and results array +NULL +array(4) { + ["first"]=> + string(3) "abc" + ["a"]=> + array(3) { + [0]=> + string(3) "123" + [1]=> + string(5) "false" + [2]=> + string(4) "last" + } + ["b"]=> + array(1) { + [0]=> + string(3) "str" + } + ["c"]=> + array(1) { + [0]=> + string(3) "3.5" + } +} + +Test string containing numerical array keys +NULL +array(1) { + ["arr"]=> + array(2) { + [1]=> + string(3) "sid" + [4]=> + string(4) "bill" + } +} + +Test string containing associative keys +NULL +array(1) { + ["arr"]=> + array(2) { + ["first"]=> + string(3) "sid" + ["forth"]=> + string(4) "bill" + } +} + +Test string with encoded data +array(2) { + ["a"]=> + string(17) "<== foo bar ==>" + ["b"]=> + string(17) "###Hello World###" +} + +Test string with single quotes characters +NULL +array(2) { + ["firstname"]=> + string(4) "Bill" + ["surname"]=> + string(8) "O'Reilly" +} + +Test string with backslash characters +NULL +array(1) { + ["sum"]=> + string(6) "10\2=5" +} + +Test string with double quotes data +NULL +array(1) { + ["str"]=> + string(30) "A string with "quoted" strings" +} + +Test string with nulls +NULL +array(1) { + ["str"]=> + string(34) "A string with containing %0%0%0 nulls" +} + +Test string with 2-dim array with numeric keys +NULL +array(1) { + ["arr"]=> + array(1) { + [3]=> + array(2) { + [4]=> + string(3) "sid" + [6]=> + string(4) "fred" + } + } +} + +Test string with 2-dim array with null keys +NULL +array(1) { + ["arr"]=> + array(2) { + [0]=> + array(1) { + [0]=> + string(3) "sid" + } + [1]=> + array(1) { + [0]=> + string(4) "fred" + } + } +} + +Test string with 2-dim array with non-numeric keys +NULL +array(1) { + ["arr"]=> + array(2) { + ["one"]=> + array(1) { + ["four"]=> + string(3) "sid" + } + ["three"]=> + array(1) { + ["six"]=> + string(4) "fred" + } + } +} + +Test string with 3-dim array with numeric keys +NULL +array(1) { + ["arr"]=> + array(1) { + [1]=> + array(1) { + [2]=> + array(2) { + [3]=> + string(3) "sid" + [6]=> + string(4) "fred" + } + } + } +} diff --git a/tests/std/strings/parse_str_basic4.phpt b/tests/std/strings/parse_str_basic4.phpt new file mode 100644 index 00000000..ce8e00c0 --- /dev/null +++ b/tests/std/strings/parse_str_basic4.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test parse_str() function : test with badly formed strings +--FILE-- + +--EXPECTF-- +Test string with badly formed strings +NULL +array(2) { + ["arr_1"]=> + string(3) "sid" + ["arr"]=> + array(1) { + [4]=> + string(4) "fred" + } +} +NULL +array(2) { + ["arr1]"]=> + string(3) "sid" + ["arr"]=> + array(1) { + [4]=> + string(4) "fred" + } +} +NULL +array(2) { + ["arr_one"]=> + string(3) "sid" + ["arr"]=> + array(1) { + [4]=> + string(4) "fred" + } +} + +Test string with badly formed % numbers +NULL +array(3) { + ["first"]=> + string(1) "A" + ["second"]=> + string(2) "%a" + ["third"]=> + string(2) "%b" +} + +Test string with non-binary safe name +NULL +array(1) { + ["arr_test"]=> + array(2) { + [1]=> + string(3) "sid" + [4]=> + array(1) { + ["two"]=> + string(4) "fred" + } + } +} diff --git a/tests/std/strings/parse_str_memory_error.phpt b/tests/std/strings/parse_str_memory_error.phpt new file mode 100644 index 00000000..12b04c89 --- /dev/null +++ b/tests/std/strings/parse_str_memory_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +parse_str() should not read uninitialized memory when checking for $this +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(1) { + ["abcd"]=> + string(1) "1" +} diff --git a/tests/std/strings/parse_str_null_bytes.phpt b/tests/std/strings/parse_str_null_bytes.phpt new file mode 100644 index 00000000..78650ae7 --- /dev/null +++ b/tests/std/strings/parse_str_null_bytes.phpt @@ -0,0 +1,18 @@ +--TEST-- +parse_str() rejects null bytes +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +parse_str(): Argument #1 ($string) must not contain any null bytes diff --git a/tests/std/strings/pathinfo.phpt b/tests/std/strings/pathinfo.phpt new file mode 100644 index 00000000..9ef4b478 --- /dev/null +++ b/tests/std/strings/pathinfo.phpt @@ -0,0 +1,143 @@ +--TEST-- +pathinfo() tests +--SKIPIF-- + +--FILE-- +getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_FILENAME); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_DIRNAME); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_FILENAME|PATHINFO_BASENAME); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_EXTENSION); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} + +try { + pathinfo(__FILE__, PATHINFO_DIRNAME-1); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} +try { + pathinfo(__FILE__, PATHINFO_ALL+1); +} catch (\ValueError $e) { + echo $e->getMessage(), PHP_EOL; +} + +echo "Done\n"; +?> +--EXPECTF-- +array(2) { + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(2) ".." + ["extension"]=> + string(0) "" + ["filename"]=> + string(1) "." +} +array(3) { + ["dirname"]=> + string(1) "%e" + ["basename"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "%e" + ["basename"]=> + string(1) "." + ["extension"]=> + string(0) "" + ["filename"]=> + string(0) "" +} +array(4) { + ["dirname"]=> + string(1) "." + ["basename"]=> + string(10) ".cvsignore" + ["extension"]=> + string(9) "cvsignore" + ["filename"]=> + string(0) "" +} +string(12) "pathinfo.php" +string(8) "pathinfo" +string(3) "php" +string(%d) "%s%estrings" +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be only one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be one of the PATHINFO_* constants +pathinfo(): Argument #2 ($flags) must be one of the PATHINFO_* constants +Done diff --git a/tests/std/strings/php_strip_whitespace.phpt b/tests/std/strings/php_strip_whitespace.phpt new file mode 100644 index 00000000..572198e6 --- /dev/null +++ b/tests/std/strings/php_strip_whitespace.phpt @@ -0,0 +1,52 @@ +--TEST-- +php_strip_whitespace() tests +--SKIPIF-- + +--FILE-- +'; +file_put_contents($filename, $data); +var_dump(php_strip_whitespace($filename)); + +$data = ''; + +file_put_contents($filename, $data); +var_dump(php_strip_whitespace($filename)); + +@unlink($filename); +echo "Done\n"; +?> +--EXPECTF-- +Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): Failed to open stream: No such file or directory in %s on line %d +string(0) "" +string(18) "/* test comment */" +string(9) "" +string(55) "" +Done diff --git a/tests/std/strings/print_basic.phpt b/tests/std/strings/print_basic.phpt new file mode 100644 index 00000000..acee52d5 --- /dev/null +++ b/tests/std/strings/print_basic.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test print() function : basic functionality +--SKIPIF-- + +--FILE-- + "foo"); + +echo "\n-- Iteration 7 --\n"; +print "this is {$bar['value']} !"; // this is foo ! + +// Using single quotes will print the variable name, not the value +echo "\n-- Iteration 8 --\n"; +print 'foo is $foo'; // foo is $foo + +// If you are not using any other characters, you can just print variables +echo "\n-- Iteration 9 --\n"; +print $foo; // foobar + +echo "\n-- Iteration 10 --\n"; +$variable = "VARIABLE"; +print << +--EXPECT-- +*** Testing print() : basic functionality *** + +-- Iteration 1 -- +Hello World +-- Iteration 2 -- +print() also works without parentheses. +-- Iteration 3 -- +This spans +multiple lines. The newlines will be +output as well +-- Iteration 4 -- +This also spans +multiple lines. The newlines will be +output as well. +-- Iteration 5 -- +escaping characters is done "Like this". +-- Iteration 6 -- +foo is foobar +-- Iteration 7 -- +this is foo ! +-- Iteration 8 -- +foo is $foo +-- Iteration 9 -- +foobar +-- Iteration 10 -- +This uses the "here document" syntax to output +multiple lines with VARIABLE interpolation. Note +that the here document terminator must appear on a +line with just a semicolon no extra whitespace! diff --git a/tests/std/strings/print_variation1.phpt b/tests/std/strings/print_variation1.phpt new file mode 100644 index 00000000..5a3e74d3 --- /dev/null +++ b/tests/std/strings/print_variation1.phpt @@ -0,0 +1,152 @@ +--TEST-- +Test print() function : usage variations +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing print() function: with unexpected inputs for 'arg' argument *** +-- Iteration 1 -- +0 +int(1) +-- Iteration 2 -- +1 +int(1) +-- Iteration 3 -- +-2 +int(1) +-- Iteration 4 -- +2147483647 +int(1) +-- Iteration 5 -- +-2147483648 +int(1) +-- Iteration 6 -- +10.5 +int(1) +-- Iteration 7 -- +-20.5 +int(1) +-- Iteration 8 -- +101234567000 +int(1) +-- Iteration 9 -- + +Warning: Array to string conversion in %s on line %d +Array +int(1) +-- Iteration 10 -- + +Warning: Array to string conversion in %s on line %d +Array +int(1) +-- Iteration 11 -- + +Warning: Array to string conversion in %s on line %d +Array +int(1) +-- Iteration 12 -- +1 +int(1) +-- Iteration 13 -- + +int(1) +-- Iteration 14 -- +1 +int(1) +-- Iteration 15 -- + +int(1) +-- Iteration 16 -- + +int(1) +-- Iteration 17 -- + +int(1) +-- Iteration 18 -- +sample object +int(1) +-- Iteration 19 -- +Resource id #%d +int(1) +-- Iteration 20 -- + +int(1) +-- Iteration 21 -- + +int(1) diff --git a/tests/std/strings/printf.phpt b/tests/std/strings/printf.phpt new file mode 100644 index 00000000..25b361cb --- /dev/null +++ b/tests/std/strings/printf.phpt @@ -0,0 +1,701 @@ +--TEST-- +Test printf() function (32bit) +--INI-- +precision=14 +--SKIPIF-- + 2147483647) { + die("skip 32bit test only"); +} +?> +--FILE-- +getMessage(), "\n"; +} + +/* Number of arguments not matching as specified in format field */ +echo "\n*** Output for insufficient number of arguments ***\n"; +$string = "dingy%sflem%dwombat"; +$nbr = 5; +$name = "voudras"; +try { + printf("%d $string %s", $nbr, $name); +} catch (\ArgumentCountError $e) { + print('Error found: '.$e->getMessage()); +} + + +/* Scalar argument */ +echo "\n*** Output for scalar argument ***\n"; +printf(3); + +/* Float type variations */ + +$counter = 1; +echo "\n\n*** Output for float type ***\n"; +echo "\n Input Float numbers variation array is:\n"; +print_r($float_numbers); + +foreach( $float_variation as $float_var ) +{ + echo "\n\nFloat Iteration $counter"; + foreach( $float_numbers as $float_num ) + { + echo "\n"; + printf( $float_var, $float_num ); + } + $counter++; +} + + +/* Integer type variations */ + +$counter = 1; +echo "\n\n*** Output for integer type ***\n"; +echo "\n Input Integer numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_variation as $int_var ) +{ + echo "\n\nInteger Iteration $counter"; + foreach( $int_numbers as $int_num ) + { + echo "\n"; + printf( $int_var, $int_num ); + } + $counter++; +} + + +/* Binary type variations */ + +echo "\n\n*** Output for binary type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + + foreach( $int_numbers as $bin_num ) + { + echo "\n"; + printf( "%b", $bin_num ); + } + + +/* Chararter type variations */ +echo "\n\n*** Output for char type ***\n"; +echo "\n Input Characters variation array is:\n"; +print_r($char_variation); + +foreach( $char_variation as $char ) +{ + echo "\n"; + printf( "%c", $char ); +} + +/* Scientific type variations */ +echo "\n\n*** Output for scientific type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $num ) +{ + echo "\n"; + printf( "%e", $num ); +} + +/* Unsigned Integer type variation */ +echo "\n\n*** Output for unsigned integer type ***\n"; +echo "\n Input Integer numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $unsig_num ) +{ + echo "\n"; + printf( "%u", $unsig_num ); +} + +/* Octal type variations */ +echo "\n\n*** Output for octal type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $octal_num ) +{ + echo "\n"; + printf( "%o", $octal_num ); +} + +/* Hexadecimal type variations */ +echo "\n\n*** Output for hexadecimal type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $hexa_num ) +{ + echo "\n"; + printf( "%x", $hexa_num ); +} + +/* String type variations */ +echo "\n\n*** Output for string type ***\n"; +echo "\n Input Strings format variation array is:\n"; +print_r($string_variation); +echo "\n Input strings variation array is:\n"; +print_r($strings); + +foreach( $string_variation as $string_var ) +{ + foreach( $strings as $str ) + { + echo "\n"; + printf( $string_var, $str ); + } +} + + +/* variations of %g type */ +$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G"); + +echo "\n\n*** Output for '%g' type ***\n"; +echo "\n Input format variation array is:\n"; +print_r($format_g); + +foreach( $format_g as $formatg ) +{ + printf("\n$formatg",123456); + printf("\n$formatg",-123456); +} + + +/* Some more typical cases */ + +$tempnum = 12345; +$tempstring = "abcdefghjklmnpqrstuvwxyz"; + +echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n"; +printf("%%%.2f",1.23456789e10); + +echo"\n\n*** Output for '%%' as the format parameter ***\n"; +printf("%%",1.23456789e10); + +echo"\n\n*** Output for precision value more than maximum ***\n"; +printf("%.988f",1.23456789e10); + +echo"\n\n*** Output for invalid width(-15) specifier ***\n"; +try { + printf("%030.-15s", $tempstring); +} catch (ValueError $e) { + echo $e->getMessage(); +} + +echo"\n\n*** Output for '%F' as the format parameter ***\n"; +printf("%F",1.23456789e10); + +echo"\n\n*** Output for '%X' as the format parameter ***\n"; +printf("%X",12); + +echo"\n\n*** Output with no format parameter ***\n"; +printf($tempnum); + +echo"\n\n*** Output for multiple format parameters ***\n"; +printf("%d %s %d\n", $tempnum, $tempstring, $tempnum); + +echo"\n\n*** Output for excess of mixed type arguments ***\n"; +printf("%s", $tempstring, $tempstring, $tempstring); + +echo"\n\n*** Output for string format parameter and integer type argument ***\n"; +printf("%s", $tempnum); + +echo"\n\n*** Output for integer format parameter and string type argument ***\n"; +printf("%d", $tempstring); + + +?> +--EXPECTF-- +*** Output for zero argument *** +printf() expects at least %d argument, %d given + +*** Output for insufficient number of arguments *** +Error found: 5 arguments are required, 3 given +*** Output for scalar argument *** +3 + +*** Output for float type *** + + Input Float numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 0.32 + [4] => -0.32 + [5] => 3.4-3.4 + [6] => 2.54 + [7] => -2.54 + [8] => 1.2345678E+99 + [9] => -1.2345678E+99 +) + + +Float Iteration 1 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567%d.000000 +-1234567%d.000000 + +Float Iteration 2 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567%d.000000 +-1234567%d.000000 + +Float Iteration 3 ++0.000000 ++1.000000 +-1.000000 ++0.320000 +-0.320000 ++3.400000 ++2.540000 +-2.540000 ++1234567%d.000000 +-1234567%d.000000 + +Float Iteration 4 + 0.00 + 1.00 + -1.00 + 0.32 + -0.32 + 3.40 + 2.54 + -2.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 5 +0.00 +1.00 +-1.00 +0.32 +-0.32 +3.40 +2.54 +-2.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 6 +0000.00 +0001.00 +-001.00 +0000.32 +-000.32 +0003.40 +0002.54 +-002.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 7 +0.00000 +1.00000 +-1.0000 +0.32000 +-0.3200 +3.40000 +2.54000 +-2.5400 +1234567%d.00 +-1234567%d.00 + +Float Iteration 8 +###0.00 +###1.00 +##-1.00 +###0.32 +##-0.32 +###3.40 +###2.54 +##-2.54 +1234567%d.00 +-1234567%d.00 + +*** Output for integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + + +Integer Iteration 1 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 2 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 3 ++0 ++1 +-1 ++2 +-2 ++23333333 +-23333333 ++1234 + +Integer Iteration 4 + 0 + 1 + -1 + 2 + -2 +23333333 +-23333333 + 1234 + +Integer Iteration 5 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 6 +0000000 +0000001 +-000001 +0000002 +-000002 +23333333 +-23333333 +0001234 + +Integer Iteration 7 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 8 +######0 +######1 +#####-1 +######2 +#####-2 +23333333 +-23333333 +###1234 + +*** Output for binary type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +11111111111111111111111111111111 +10 +11111111111111111111111111111110 +1011001000000100111010101 +11111110100110111111011000101011 +10011010010 + +*** Output for char type *** + + Input Characters variation array is: +Array +( + [0] => a + [1] => a + [2] => 67 + [3] => -67 + [4] => 99 +) + +%0 +%0 +C +½ +c + +*** Output for scientific type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0.000000e+0 +1.000000e+0 +-1.000000e+0 +2.700000e+0 +-2.700000e+0 +2.333333e+7 +-2.333333e+7 +1.234000e+3 + +*** Output for unsigned integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +4294967295 +2 +4294967294 +23333333 +4271633963 +1234 + +*** Output for octal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +37777777777 +2 +37777777776 +131004725 +37646773053 +2322 + +*** Output for hexadecimal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +ffffffff +2 +fffffffe +16409d5 +fe9bf62b +4d2 + +*** Output for string type *** + + Input Strings format variation array is: +Array +( + [0] => %5s + [1] => %-5s + [2] => %r%%r05s + [3] => %'#5s +) + + Input strings variation array is: +Array +( + [0] => + [1] => abc + [2] => aaa +) + + + abc + aaa + +abc +aaa +00000 +00abc +00aaa +##### +##abc +##aaa + +*** Output for '%g' type *** + + Input format variation array is: +Array +( + [0] => %g + [1] => %.0g + [2] => %+g + [3] => %-g + [4] => %-1.2g + [5] => %+1.2g + [6] => %G + [7] => %.0G + [8] => %+G + [9] => %-G + [10] => %-1.2G + [11] => %+1.2G +) + +123456 +-123456 +1.0e+5 +-1.0e+5 ++123456 +-123456 +123456 +-123456 +1.2e+5 +-1.2e+5 ++1.2e+5 +-1.2e+5 +123456 +-123456 +1.0E+5 +-1.0E+5 ++123456 +-123456 +123456 +-123456 +1.2E+5 +-1.2E+5 ++1.2E+5 +-1.2E+5 + +*** Output for '%%%.2f' as the format parameter *** +%12345678900.00 + +*** Output for '%%' as the format parameter *** +% + +*** Output for precision value more than maximum *** + +Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of 53 digits in %s on line %d +12345678900.00000000000000000000000000000000000000000000000000000 + +*** Output for invalid width(-15) specifier *** +Unknown format specifier "-" + +*** Output for '%F' as the format parameter *** +12345678900.000000 + +*** Output for '%X' as the format parameter *** +C + +*** Output with no format parameter *** +12345 + +*** Output for multiple format parameters *** +12345 abcdefghjklmnpqrstuvwxyz 12345 + + +*** Output for excess of mixed type arguments *** +abcdefghjklmnpqrstuvwxyz + +*** Output for string format parameter and integer type argument *** +12345 + +*** Output for integer format parameter and string type argument *** +0 diff --git a/tests/std/strings/printf_64bit.phpt b/tests/std/strings/printf_64bit.phpt new file mode 100644 index 00000000..eb274927 --- /dev/null +++ b/tests/std/strings/printf_64bit.phpt @@ -0,0 +1,699 @@ +--TEST-- +Test printf() function (64bit) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- +getMessage(), "\n"; +} + +/* Number of arguments not matching as specified in format field */ +echo "\n*** Output for insufficient number of arguments ***\n"; +$string = "dingy%sflem%dwombat"; +$nbr = 5; +$name = "voudras"; +try { + printf("%d $string %s", $nbr, $name); +} catch (\ArgumentCountError $e) { + print('Error found: '.$e->getMessage()); +} + + +/* Scalar argument */ +echo "\n*** Output for scalar argument ***\n"; +printf(3); + +/* Float type variations */ + +$counter = 1; +echo "\n\n*** Output for float type ***\n"; +echo "\n Input Float numbers variation array is:\n"; +print_r($float_numbers); + +foreach( $float_variation as $float_var ) +{ + echo "\n\nFloat Iteration $counter"; + foreach( $float_numbers as $float_num ) + { + echo "\n"; + printf( $float_var, $float_num ); + } + $counter++; +} + + +/* Integer type variations */ + +$counter = 1; +echo "\n\n*** Output for integer type ***\n"; +echo "\n Input Integer numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_variation as $int_var ) +{ + echo "\n\nInteger Iteration $counter"; + foreach( $int_numbers as $int_num ) + { + echo "\n"; + printf( $int_var, $int_num ); + } + $counter++; +} + + +/* Binary type variations */ + +echo "\n\n*** Output for binary type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + + foreach( $int_numbers as $bin_num ) + { + echo "\n"; + printf( "%b", $bin_num ); + } + + +/* Chararter type variations */ +echo "\n\n*** Output for char type ***\n"; +echo "\n Input Characters variation array is:\n"; +print_r($char_variation); + +foreach( $char_variation as $char ) +{ + echo "\n"; + printf( "%c", $char ); +} + +/* Scientific type variations */ +echo "\n\n*** Output for scientific type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $num ) +{ + echo "\n"; + printf( "%e", $num ); +} + +/* Unsigned Integer type variation */ +echo "\n\n*** Output for unsigned integer type ***\n"; +echo "\n Input Integer numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $unsig_num ) +{ + echo "\n"; + printf( "%u", $unsig_num ); +} + +/* Octal type variations */ +echo "\n\n*** Output for octal type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $octal_num ) +{ + echo "\n"; + printf( "%o", $octal_num ); +} + +/* Hexadecimal type variations */ +echo "\n\n*** Output for hexadecimal type ***\n"; +echo "\n Input numbers variation array is:\n"; +print_r($int_numbers); + +foreach( $int_numbers as $hexa_num ) +{ + echo "\n"; + printf( "%x", $hexa_num ); +} + +/* String type variations */ +echo "\n\n*** Output for string type ***\n"; +echo "\n Input Strings format variation array is:\n"; +print_r($string_variation); +echo "\n Input strings variation array is:\n"; +print_r($strings); + +foreach( $string_variation as $string_var ) +{ + foreach( $strings as $str ) + { + echo "\n"; + printf( $string_var, $str ); + } +} + + +/* variations of %g type */ +$format_g = array("%g", "%.0g", "%+g", "%-g", "%-1.2g", "%+1.2g", "%G", "%.0G", "%+G", "%-G", "%-1.2G", "%+1.2G"); + +echo "\n\n*** Output for '%g' type ***\n"; +echo "\n Input format variation array is:\n"; +print_r($format_g); + +foreach( $format_g as $formatg ) +{ + printf("\n$formatg",123456); + printf("\n$formatg",-123456); +} + + +/* Some more typical cases */ + +$tempnum = 12345; +$tempstring = "abcdefghjklmnpqrstuvwxyz"; + +echo"\n\n*** Output for '%%%.2f' as the format parameter ***\n"; +printf("%%%.2f",1.23456789e10); + +echo"\n\n*** Output for '%%' as the format parameter ***\n"; +printf("%%",1.23456789e10); + +echo"\n\n*** Output for precision value more than maximum ***\n"; +printf("%.988f",1.23456789e10); + +echo"\n\n*** Output for invalid width(-15) specifier ***\n"; +try { + printf("%030.-15s", $tempstring); +} catch (ValueError $e) { + echo $e->getMessage(); +} + +echo"\n\n*** Output for '%F' as the format parameter ***\n"; +printf("%F",1.23456789e10); + +echo"\n\n*** Output for '%X' as the format parameter ***\n"; +printf("%X",12); + +echo"\n\n*** Output with no format parameter ***\n"; +printf($tempnum); + +echo"\n\n*** Output for multiple format parameters ***\n"; +printf("%d %s %d\n", $tempnum, $tempstring, $tempnum); + +echo"\n\n*** Output for excess of mixed type arguments ***\n"; +printf("%s", $tempstring, $tempstring, $tempstring); + +echo"\n\n*** Output for string format parameter and integer type argument ***\n"; +printf("%s", $tempnum); + +echo"\n\n*** Output for integer format parameter and string type argument ***\n"; +printf("%d", $tempstring); + + +?> +--EXPECTF-- +*** Output for zero argument *** +printf() expects at least 1 argument, 0 given + +*** Output for insufficient number of arguments *** +Error found: 5 arguments are required, 3 given +*** Output for scalar argument *** +3 + +*** Output for float type *** + + Input Float numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 0.32 + [4] => -0.32 + [5] => 3.4-3.4 + [6] => 2.54 + [7] => -2.54 + [8] => 1.2345678E+99 + [9] => -1.2345678E+99 +) + + +Float Iteration 1 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 + +Float Iteration 2 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 + +Float Iteration 3 ++0.000000 ++1.000000 +-1.000000 ++0.320000 +-0.320000 ++3.400000 ++2.540000 +-2.540000 ++1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.000000 + +Float Iteration 4 + 0.00 + 1.00 + -1.00 + 0.32 + -0.32 + 3.40 + 2.54 + -2.54 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 + +Float Iteration 5 +0.00 +1.00 +-1.00 +0.32 +-0.32 +3.40 +2.54 +-2.54 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 + +Float Iteration 6 +0000.00 +0001.00 +-001.00 +0000.32 +-000.32 +0003.40 +0002.54 +-002.54 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 + +Float Iteration 7 +0.00000 +1.00000 +-1.0000 +0.32000 +-0.3200 +3.40000 +2.54000 +-2.5400 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 + +Float Iteration 8 +###0.00 +###1.00 +##-1.00 +###0.32 +##-0.32 +###3.40 +###2.54 +##-2.54 +1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 +-1234567799999999974395005011934353453808157274826416694779123657996479008398428960266851879135215616.00 + +*** Output for integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + + +Integer Iteration 1 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 2 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 3 ++0 ++1 +-1 ++2 +-2 ++23333333 +-23333333 ++1234 + +Integer Iteration 4 + 0 + 1 + -1 + 2 + -2 +23333333 +-23333333 + 1234 + +Integer Iteration 5 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 6 +0000000 +0000001 +-000001 +0000002 +-000002 +23333333 +-23333333 +0001234 + +Integer Iteration 7 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 8 +######0 +######1 +#####-1 +######2 +#####-2 +23333333 +-23333333 +###1234 + +*** Output for binary type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +1111111111111111111111111111111111111111111111111111111111111111 +10 +1111111111111111111111111111111111111111111111111111111111111110 +1011001000000100111010101 +1111111111111111111111111111111111111110100110111111011000101011 +10011010010 + +*** Output for char type *** + + Input Characters variation array is: +Array +( + [0] => a + [1] => a + [2] => 67 + [3] => -67 + [4] => 99 +) + +%0 +%0 +C +½ +c + +*** Output for scientific type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0.000000e+0 +1.000000e+0 +-1.000000e+0 +2.700000e+0 +-2.700000e+0 +2.333333e+7 +-2.333333e+7 +1.234000e+3 + +*** Output for unsigned integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +18446744073709551615 +2 +18446744073709551614 +23333333 +18446744073686218283 +1234 + +*** Output for octal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +1777777777777777777777 +2 +1777777777777777777776 +131004725 +1777777777777646773053 +2322 + +*** Output for hexadecimal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +ffffffffffffffff +2 +fffffffffffffffe +16409d5 +fffffffffe9bf62b +4d2 + +*** Output for string type *** + + Input Strings format variation array is: +Array +( + [0] => %5s + [1] => %-5s + [2] => %r%%r05s + [3] => %'#5s +) + + Input strings variation array is: +Array +( + [0] => + [1] => abc + [2] => aaa +) + + + abc + aaa + +abc +aaa +00000 +00abc +00aaa +##### +##abc +##aaa + +*** Output for '%g' type *** + + Input format variation array is: +Array +( + [0] => %g + [1] => %.0g + [2] => %+g + [3] => %-g + [4] => %-1.2g + [5] => %+1.2g + [6] => %G + [7] => %.0G + [8] => %+G + [9] => %-G + [10] => %-1.2G + [11] => %+1.2G +) + +123456 +-123456 +1.0e+5 +-1.0e+5 ++123456 +-123456 +123456 +-123456 +1.2e+5 +-1.2e+5 ++1.2e+5 +-1.2e+5 +123456 +-123456 +1.0E+5 +-1.0E+5 ++123456 +-123456 +123456 +-123456 +1.2E+5 +-1.2E+5 ++1.2E+5 +-1.2E+5 + +*** Output for '%%%.2f' as the format parameter *** +%12345678900.00 + +*** Output for '%%' as the format parameter *** +% + +*** Output for precision value more than maximum *** + +Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of %d digits in %s on line %d +12345678900.0000000000%d + +*** Output for invalid width(-15) specifier *** +Unknown format specifier "-" + +*** Output for '%F' as the format parameter *** +12345678900.000000 + +*** Output for '%X' as the format parameter *** +C + +*** Output with no format parameter *** +12345 + +*** Output for multiple format parameters *** +12345 abcdefghjklmnpqrstuvwxyz 12345 + + +*** Output for excess of mixed type arguments *** +abcdefghjklmnpqrstuvwxyz + +*** Output for string format parameter and integer type argument *** +12345 + +*** Output for integer format parameter and string type argument *** +0 diff --git a/tests/std/strings/printf_basic1.phpt b/tests/std/strings/printf_basic1.phpt new file mode 100644 index 00000000..f0b6f2e4 --- /dev/null +++ b/tests/std/strings/printf_basic1.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test printf() function : basic functionality - string format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using string format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments -- +arg1 argument +int(13) + +-- Calling printf() with two arguments -- +arg1 argument arg2 argument +int(27) + +-- Calling printf() with string three arguments -- +arg1 argument arg2 argument arg3 argument +int(41) diff --git a/tests/std/strings/printf_basic2.phpt b/tests/std/strings/printf_basic2.phpt new file mode 100644 index 00000000..5a5df0ad --- /dev/null +++ b/tests/std/strings/printf_basic2.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test printf() function : basic functionality - integer format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using integer format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments-- +111 +int(3) + +-- Calling printf() with two arguments-- +111 222 +int(7) + +-- Calling printf() with three arguments-- +111 222 333 +int(11) diff --git a/tests/std/strings/printf_basic3.phpt b/tests/std/strings/printf_basic3.phpt new file mode 100644 index 00000000..0e26dbd5 --- /dev/null +++ b/tests/std/strings/printf_basic3.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test printf() function : basic functionality - float format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using float format *** + +-- Calling printf() with no arguments-- +format +int(6) + +-- Calling printf() with one arguments-- +11.110000 +int(9) +11.110000 +int(9) + +-- Calling printf() with two arguments-- +11.110000 22.220000 +int(19) +11.110000 22.220000 +int(19) + +-- Calling printf() with three arguments-- +11.110000 22.220000 33.330000 +int(29) +11.110000 22.220000 33.330000 +int(29) diff --git a/tests/std/strings/printf_basic4.phpt b/tests/std/strings/printf_basic4.phpt new file mode 100644 index 00000000..3cc00cce --- /dev/null +++ b/tests/std/strings/printf_basic4.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test printf() function : basic functionality - bool format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using bool format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments-- +1 +int(1) + +-- Calling printf() with two arguments-- +1 0 +int(3) + +-- Calling printf() with three arguments-- +1 0 1 +int(5) diff --git a/tests/std/strings/printf_basic5.phpt b/tests/std/strings/printf_basic5.phpt new file mode 100644 index 00000000..90b16051 --- /dev/null +++ b/tests/std/strings/printf_basic5.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test printf() function : basic functionality - char format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using char format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments -- +A +int(1) + +-- Calling printf() with two arguments -- +A B +int(3) + +-- Calling printf() with three arguments -- +A B C +int(5) diff --git a/tests/std/strings/printf_basic6.phpt b/tests/std/strings/printf_basic6.phpt new file mode 100644 index 00000000..30872440 --- /dev/null +++ b/tests/std/strings/printf_basic6.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test printf() function : basic functionality - exponential format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using exponential format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one argument -- +1.000000e+3 +int(11) + +-- Calling printf() with two arguments -- +1.000000E+3 2.000000e+3 +int(23) + +-- Calling printf() with three arguments -- +1.000000e+3 2.000000E+3 3.000000e+3 +int(35) diff --git a/tests/std/strings/printf_basic7.phpt b/tests/std/strings/printf_basic7.phpt new file mode 100644 index 00000000..b7218cd7 --- /dev/null +++ b/tests/std/strings/printf_basic7.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test printf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using unsigned format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments -- +4294966185 +int(10) + +-- Calling printf() with two arguments -- +4294966185 4293732729 +int(21) + +-- Calling printf() with three arguments -- +4294966185 4293732729 2345432 +int(29) diff --git a/tests/std/strings/printf_basic8.phpt b/tests/std/strings/printf_basic8.phpt new file mode 100644 index 00000000..395972ba --- /dev/null +++ b/tests/std/strings/printf_basic8.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test printf() function : basic functionality - octal format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using octal format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments -- +21 +int(2) + +-- Calling printf() with two arguments -- +21 37777777431 +int(14) + +-- Calling printf() with three arguments -- +21 37777777431 567 +int(18) diff --git a/tests/std/strings/printf_basic9.phpt b/tests/std/strings/printf_basic9.phpt new file mode 100644 index 00000000..b24f862a --- /dev/null +++ b/tests/std/strings/printf_basic9.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test printf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECT-- +*** Testing printf() : basic functionality - using hexadecimal format *** + +-- Calling printf() with no arguments -- +format +int(6) + +-- Calling printf() with one arguments -- +b +int(1) +B +int(1) + +-- Calling printf() with two arguments -- +b 84 +int(4) +B 84 +int(4) + +-- Calling printf() with three arguments -- +b 84 b1 +int(7) +B 84 B1 +int(7) diff --git a/tests/std/strings/printf_error.phpt b/tests/std/strings/printf_error.phpt new file mode 100644 index 00000000..066e0114 --- /dev/null +++ b/tests/std/strings/printf_error.phpt @@ -0,0 +1,81 @@ +--TEST-- +Test printf() function : error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; +$format1 = '%s'; +$format2 = '%s%s'; +$format3 = '%s%s%s'; +$arg1 = 'one'; +$arg2 = 'two'; + +echo "\n-- Call printf with one argument less than expected --\n"; +try { + var_dump( printf($format1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( printf($format2,$arg1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( printf($format3,$arg1,$arg2) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Call printf with two argument less than expected --\n"; +try { + var_dump( printf($format2) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( printf($format3,$arg1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Call printf with three argument less than expected --\n"; +try { + var_dump( printf($format3) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +*** Testing printf() : error conditions *** + +-- Testing printf() function with Zero arguments -- +printf() expects at least 1 argument, 0 given + +-- Testing printf() function with less than expected no. of arguments -- + +-- Call printf with one argument less than expected -- +2 arguments are required, 1 given +3 arguments are required, 2 given +4 arguments are required, 3 given + +-- Call printf with two argument less than expected -- +3 arguments are required, 1 given +4 arguments are required, 2 given + +-- Call printf with three argument less than expected -- +4 arguments are required, 1 given diff --git a/tests/std/strings/printf_h_H.phpt b/tests/std/strings/printf_h_H.phpt new file mode 100644 index 00000000..01fe69ac --- /dev/null +++ b/tests/std/strings/printf_h_H.phpt @@ -0,0 +1,20 @@ +--TEST-- +sprintf() %h and %H specifiers +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1,25 1,25 1.25 1.25 +1,25e-6 1,25E-6 1.25e-6 1.25E-6 diff --git a/tests/std/strings/printf_variation2.phpt b/tests/std/strings/printf_variation2.phpt new file mode 100644 index 00000000..8a5cd5ac --- /dev/null +++ b/tests/std/strings/printf_variation2.phpt @@ -0,0 +1,296 @@ +--TEST-- +Test printf() function : usage variations - with all types of values for arg1 argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // string data +/*23*/ "string", + 'string', + + // object data +/*25*/ new sample(), + + // undefined data +/*26*/ @$undefined_var, + + // unset data +/*27*/ @$unset_var, + + // resource data +/*28*/ $file_handle +); + +// loop through each element of the array for arg1 + +$count = 1; +foreach($values as $value) { + echo "\n-- Iteration $count --\n"; + + // with two arguments + $result = printf($format, $value); + echo "\n"; + var_dump($result); + + // with three arguments + $result = printf($format, $value, $arg2); + echo "\n"; + var_dump($result); + + $count++; +}; + +// closing the resource +fclose($file_handle); + +?> +--EXPECTF-- +*** Testing printf() : with different types of values passed for arg1 argument *** + +-- Iteration 1 -- +0 +int(1) +0 +int(1) + +-- Iteration 2 -- +1 +int(1) +1 +int(1) + +-- Iteration 3 -- +12345 +int(5) +12345 +int(5) + +-- Iteration 4 -- +-2345 +int(5) +-2345 +int(5) + +-- Iteration 5 -- +10.5 +int(4) +10.5 +int(4) + +-- Iteration 6 -- +-10.5 +int(5) +-10.5 +int(5) + +-- Iteration 7 -- +101234567000 +int(12) +101234567000 +int(12) + +-- Iteration 8 -- +1.07654321E-9 +int(13) +1.07654321E-9 +int(13) + +-- Iteration 9 -- +0.5 +int(3) +0.5 +int(3) + +-- Iteration 10 -- + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +-- Iteration 11 -- + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +-- Iteration 12 -- + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +-- Iteration 13 -- + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +-- Iteration 14 -- + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +Warning: Array to string conversion in %s on line %d +Array +int(5) + +-- Iteration 15 -- + +int(0) + +int(0) + +-- Iteration 16 -- + +int(0) + +int(0) + +-- Iteration 17 -- +1 +int(1) +1 +int(1) + +-- Iteration 18 -- + +int(0) + +int(0) + +-- Iteration 19 -- +1 +int(1) +1 +int(1) + +-- Iteration 20 -- + +int(0) + +int(0) + +-- Iteration 21 -- + +int(0) + +int(0) + +-- Iteration 22 -- + +int(0) + +int(0) + +-- Iteration 23 -- +string +int(6) +string +int(6) + +-- Iteration 24 -- +string +int(6) +string +int(6) + +-- Iteration 25 -- +Object +int(6) +Object +int(6) + +-- Iteration 26 -- + +int(0) + +int(0) + +-- Iteration 27 -- + +int(0) + +int(0) + +-- Iteration 28 -- +Resource id #%d +int(%d) +Resource id #%d +int(%d) diff --git a/tests/std/strings/quoted_printable_decode_basic.phpt b/tests/std/strings/quoted_printable_decode_basic.phpt new file mode 100644 index 00000000..5b23f1a7 --- /dev/null +++ b/tests/std/strings/quoted_printable_decode_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test quoted_printable_decode() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing quoted_printable_decode() : basic functionality *** +string(76) "fa776f772d666163746f72c1d0d5ddc5ceced9c50a20d4cfd2c7cfd7d9c520d0d2cfc5cbd4d9" diff --git a/tests/std/strings/quoted_printable_encode_001.phpt b/tests/std/strings/quoted_printable_encode_001.phpt new file mode 100644 index 00000000..a1e0ec13 --- /dev/null +++ b/tests/std/strings/quoted_printable_encode_001.phpt @@ -0,0 +1,19 @@ +--TEST-- +quoted_printable_encode() tests - 1 +--FILE-- + +--EXPECT-- +string(0) "" +string(4) "test" +string(1) "1" +string(0) "" +Done diff --git a/tests/std/strings/quoted_printable_encode_002.phpt b/tests/std/strings/quoted_printable_encode_002.phpt new file mode 100644 index 00000000..429b6f8f --- /dev/null +++ b/tests/std/strings/quoted_printable_encode_002.phpt @@ -0,0 +1,102 @@ +--TEST-- +quoted_printable_encode() tests - 2 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(621) "=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00= +=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00" +string(200) "%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0%0" +string(4480) "=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0= +=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD= +=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0= +=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE= +=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1= +=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4= +=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0= +=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E= +=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 = +=D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0= +=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81= +=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0= +=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8= +=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1= +=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0= +=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80= +=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1= +=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE= +=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0= +=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 = +=D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA= +=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1= +=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5= +=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0= +=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD= +=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0= +=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE= +=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1= +=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4= +=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0= +=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E= +=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 = +=D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0= +=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81= +=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0= +=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8= +=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1= +=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0= +=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80= +=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1= +=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE= +=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0= +=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 = +=D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA= +=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1= +=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5= +=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0= +=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD= +=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0= +=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE= +=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1= +=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4= +=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0= +=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E= +=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 = +=D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0= +=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5=D1=81= +=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0= +=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1=8E=D0=BD=D0=B8= +=D0=BA=D0=BE=D0=B4=D0=B5=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0 =D0=B2 =D1= +=8E=D0=BD=D0=B8=D0=BA=D0=BE=D0=B4=D0=B5" +string(1500) "Ñтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникодеÑтрока в юникоде" +string(13) "this is a foo" +Done diff --git a/tests/std/strings/quotemeta_basic.phpt b/tests/std/strings/quotemeta_basic.phpt new file mode 100644 index 00000000..5ea93e69 --- /dev/null +++ b/tests/std/strings/quotemeta_basic.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test quotemeta() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing quotemeta() : basic functionality *** +string(20) "Hello how are you \?" +string(19) "\(100 \+ 50\) \* 10" +string(20) "\\\+\*\?\[\^\]\(\$\)" diff --git a/tests/std/strings/quotemeta_basic_1.phpt b/tests/std/strings/quotemeta_basic_1.phpt new file mode 100644 index 00000000..4d1feb5a --- /dev/null +++ b/tests/std/strings/quotemeta_basic_1.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test function quotemeta() - using an empty string is given as str +--CREDITS-- +Rodrigo Prado de Jesus +User Group: PHPSP #PHPTestFestBrasil +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/tests/std/strings/rtrim.phpt b/tests/std/strings/rtrim.phpt new file mode 100644 index 00000000..40532775 --- /dev/null +++ b/tests/std/strings/rtrim.phpt @@ -0,0 +1,68 @@ +--TEST-- +Testing rtrim() function +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Output for Normal Behaviour *** +string(10) "rtrim test" +string(13) "rtrim test " +string(18) "rtrim test " +string(10) "rtrim test" +string(11) "rtrim test " +string(10) "rtrim test" +string(10) "rtrim test" +string(10) "rtrim test" + +*** Checking with OBJECTS *** +string(4) "Obje" + +*** String with embedded NULL *** +string(22) "234%005678%000efgh\xijkl" + + *** Using heredoc string *** +string(18) "us +ing heredoc str" +Done diff --git a/tests/std/strings/rtrim_basic.phpt b/tests/std/strings/rtrim_basic.phpt new file mode 100644 index 00000000..ed0ca83b --- /dev/null +++ b/tests/std/strings/rtrim_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test rtrim() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing rtrim() : basic functionality *** + +-- Trim string with all white space characters -- +string(27) "---These are a few words---" + +-- Trim non-whitespace from a string -- +string(15) "!===Hello World" + +-- Trim some non-white space characters from a string -- +string(10) "!===Hello " + +-- Trim some non-white space characters from a string using a character range -- +string(10) "0123456789" + +-- Trim the ASCII control characters at the beginning of a string -- +string(14) "Example string" diff --git a/tests/std/strings/rtrim_error.phpt b/tests/std/strings/rtrim_error.phpt new file mode 100644 index 00000000..81a4d65a --- /dev/null +++ b/tests/std/strings/rtrim_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test rtrim() function : error conditions +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing rtrim() : error conditions *** + +-- Test rtrim function with various invalid charlists + +Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d +string(14) " Hello World +" + +Warning: rtrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d +string(14) " Hello World +" + +Warning: rtrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +string(14) " Hello World +" + +Warning: rtrim(): Invalid '..'-range in %s on line %d +string(14) " Hello World +" diff --git a/tests/std/strings/sapi_windows_cp_conv.phpt b/tests/std/strings/sapi_windows_cp_conv.phpt new file mode 100644 index 00000000..6360fa02 --- /dev/null +++ b/tests/std/strings/sapi_windows_cp_conv.phpt @@ -0,0 +1,21 @@ +--TEST-- +sapi_windows_cp_conv basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(6) "e4f6fc" +string(6) "e4f6fc" +string(6) "e4f6fc" +string(6) "e4f6fc" diff --git a/tests/std/strings/setlocale-win32.phpt b/tests/std/strings/setlocale-win32.phpt new file mode 100644 index 00000000..e6aeda5f --- /dev/null +++ b/tests/std/strings/setlocale-win32.phpt @@ -0,0 +1,23 @@ +--TEST-- +Unix locale names are rejected on Windows, except for some special cases +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +string(27) "English_United Kingdom.1252" +string(26) "English_United States.1252" +string(27) "English_United Kingdom.1252" +string(26) "English_United States.1252" diff --git a/tests/std/strings/setlocale_basic1.phpt b/tests/std/strings/setlocale_basic1.phpt new file mode 100644 index 00000000..976bd68a --- /dev/null +++ b/tests/std/strings/setlocale_basic1.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test setlocale() function : basic functionality - setting system locale to a specific +--SKIPIF-- + +--FILE-- + "en_US.utf8", + "english_AU" => "en_AU.utf8", + "korean_KR" => "ko_KR.utf8", + "Chinese_zh" => "zh_CN.utf8", + "germen_DE" => "de_DE.utf8", + "spanish_es" => "es_EC.utf8", + "french_FR" => "fr_FR.utf8", + "japanees_JP" => "ja_JP.utf8", + "greek_GR" => "el_GR.utf8", + "dutch_NL" => "nl_NL.utf8" +); + +//set of currency symbol according to above list of locales +$currency_symbol = array( + "en_US.utf8" => "USD", + "en_AU.utf8" => "AUD", + "ko_KR.utf8" => "KRW", + "zh_CN.utf8" => "CNY", + "de_DE.utf8" => "EUR", + "es_EC.utf8" => "USD", + "fr_FR.utf8" => "EUR", + "ja_JP.utf8" => "JPY", + "el_GR.utf8" => "EUR", + "nl_NL.utf8" =>"EUR" +); + +// gather all the locales installed in the system +$all_system_locales = list_system_locales(); + +// set the system locale to a locale, choose the right locale by +// finding a common locale in commonly used locale stored in +// $common_locales & locales that are available in the system, stored +// in $all_system_locales. +echo "Setting system locale(LC_ALL) to "; +foreach($common_locales as $value) { + // check if a commonly used locale is installed in the system + // Solaris uses .UTF-8 canonical form, so normalize + $normalized = preg_replace('/\.utf8$/i', '.UTF-8', $value); + + if (in_array($value, $all_system_locales) || + in_array($normalized, $all_system_locales)) { + echo "$value\n"; // print, this is found + // set the found locale as current locale + var_dump(setlocale(LC_ALL, $value )); + // stop here + break; + } + else{ + // continue to check if next commonly locale is installed in the system + continue; + } +} + +// check that new locale setting is effective +// use localeconv() to get the details of currently set locale +$locale_info = localeconv(); + +//checking currency settings in the new locale to see if the setlocale() was effective +$new_currency = trim($locale_info['int_curr_symbol']); +echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$value].", Found: ".$new_currency."\n"; +echo "Test "; +if(trim($currency_symbol[$value]) == $new_currency){ + echo "PASSED."; +} else { + echo "FAILED."; +} + +echo "\nDone\n"; +?> +--EXPECTF-- +*** Testing setlocale() : basic functionality - set to a specific locale *** +Setting system locale(LC_ALL) to %s +string(%d) %s +Checking currency settings in the new locale, expected: %s, Found: %s +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_basic2.phpt b/tests/std/strings/setlocale_basic2.phpt new file mode 100644 index 00000000..3b17265c --- /dev/null +++ b/tests/std/strings/setlocale_basic2.phpt @@ -0,0 +1,117 @@ +--TEST-- +Test setlocale() function : basic functionality - set locale using an array +--SKIPIF-- + +--FILE-- + "en_US.utf8", + "english_AU" => "en_AU.utf8", + "korean_KR" => "ko_KR.utf8", + "Chinese_zh" => "zh_CN.utf8", + "germen_DE" => "de_DE.utf8", + "spanish_es" => "es_EC.utf8", + "french_FR" => "fr_FR.utf8", + "japanees_JP" => "ja_JP.utf8", + "greek_GR" => "el_GR.utf8", + "dutch_NL" => "nl_NL.utf8" +); + +//set of currency symbol according to above list of locales +$currency_symbol = array( + "en_US.utf8" => "USD", + "en_AU.utf8" => "AUD", + "ko_KR.utf8" => "KRW", + "zh_CN.utf8" => "CNY", + "de_DE.utf8" => "EUR", + "es_EC.utf8" => "USD", + "fr_FR.utf8" => "EUR", + "ja_JP.utf8" => "JPY", + "el_GR.utf8" => "EUR", + "nl_NL.utf8" =>"EUR" +); + +// gather all the locales installed in the system +$all_system_locales = list_system_locales(); + +// prepare the list of locales based on list of locales found in the system +// and those known to this script ( as stored $common_locales) which can be +// given as input to setlocale(), later verify the new locale setting by +// checking the currency setting of the system(use localconv()) +$list_of_locales = array(); +foreach($common_locales as $value) { + // Solaris uses canonical .UTF-8 form, so normalize the name + $normalized = preg_replace('/\.utf8$/i', '.UTF-8', $value); + + if (in_array($value, $all_system_locales) || + in_array($normalized, $all_system_locales)) { + + $list_of_locales[] = $value; + } +} + +// Now $list_of_locales array contains the locales that can be passed to +// setlocale() function. +echo "-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array --\n"; +if ( count($list_of_locales) > 0 ) { + // set locale to $list_of_locales + $new_locale = setlocale(LC_ALL, $list_of_locales); + + // dump the current locale + var_dump($new_locale); + + // check that new locale setting is effective + // use localeconv() to get the details of currently set locale + $locale_info = localeconv(); + $new_currency = trim($locale_info['int_curr_symbol']); + + echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n"; + echo "Test "; + + if(trim($currency_symbol[$new_locale]) == $new_currency){ + echo "PASSED.\n"; + } else { + echo "FAILED.\n"; + } +} else { + echo "Test FAILED.\n"; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing setlocale() with an array containing list of locales *** +-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array -- +string(%d) "%s" +Checking currency settings in the new locale, expected: %s, Found: %s +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_basic3.phpt b/tests/std/strings/setlocale_basic3.phpt new file mode 100644 index 00000000..422e3d5a --- /dev/null +++ b/tests/std/strings/setlocale_basic3.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test setlocale() function : basic functionality - passing multiple locales as argument +--SKIPIF-- + +--FILE-- + "USD", + "en_AU.$utfending" => "AUD", + "ko_KR.$utfending" => "KRW", + "zh_CN.$utfending" => "CNY", + "de_DE.$utfending" => "EUR", + "es_EC.$utfending" => "USD", + "fr_FR.$utfending" => "EUR", + "ja_JP.$utfending" => "JPY", + "el_GR.$utfending" => "EUR", + "nl_NL.$utfending" =>"EUR" +); + +// gather all the locales installed in the system +$all_system_locales = list_system_locales(); + +// Now check for three locales that is present in the system and use that as argument to setlocale() +if( in_array("en_US.$utfending",$all_system_locales) || + in_array("Ko_KR.$utfending",$all_system_locales) || + in_array("zh_CN.$utfending",$all_system_locales) ) { + echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --\n"; + + // call setlocale() + $new_locale = setlocale(LC_ALL, "en_US.$utfending", "Ko_KR.$utfending", "zh_CN.$utfending"); + + // dump the name of the new locale set by setlocale() + var_dump($new_locale); + + // check that new locale setting is effective + // use localeconv() to get the details of currently set locale + $locale_info = localeconv(); + $new_currency = trim($locale_info['int_curr_symbol']); + + echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n"; + echo "Test "; + if( trim($currency_symbol[$new_locale]) == $new_currency) { + echo "PASSED.\n"; + } else { + echo "FAILED.\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing setlocale() by passing multiple locales as argument *** +-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) -- +string(%d) "%s" +Checking currency settings in the new locale, expected: %s, Found: %s +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_error.phpt b/tests/std/strings/setlocale_error.phpt new file mode 100644 index 00000000..0899e848 --- /dev/null +++ b/tests/std/strings/setlocale_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test setlocale() function : error condition +--INI-- +error_reporting=E_ALL +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing setlocale() : error conditions *** + +-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- +bool(false) + +-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL -- +bool(false) + +-- Testing setlocale() function with locale name too long, 'category' = LC_ALL -- +Warning: setlocale(): Specified locale name is too long in %s on line %d +bool(false) + +Done diff --git a/tests/std/strings/setlocale_variation1.phpt b/tests/std/strings/setlocale_variation1.phpt new file mode 100644 index 00000000..c5e01b68 --- /dev/null +++ b/tests/std/strings/setlocale_variation1.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test setlocale() function : usage variations - passing multiple valid/invalid locales as argument +--SKIPIF-- + +--FILE-- + "USD", + "en_AU.$utfending" => "AUD", + "ko_KR.$utfending" => "KRW", + "zh_CN.$utfending" => "CNY", + "de_DE.$utfending" => "EUR", + "es_EC.$utfending" => "USD", + "fr_FR.$utfending" => "EUR", + "ja_JP.$utfending" => "JPY", + "el_GR.$utfending" => "EUR", + "nl_NL.$utfending" =>"EUR" +); + +// gather all the locales installed in the system +$all_system_locales = list_system_locales(); + +// Now check for three locales that is present in the system and use that as argument to setlocale() +if( in_array("en_US.$utfending",$all_system_locales) || + in_array("Ko_KR.$utfending",$all_system_locales) || + in_array("zh_CN.$utfending",$all_system_locales) ) { + echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --\n"; + + // call setlocale() + $new_locale = setlocale(LC_ALL, "en_US.invalid", "en_US.$utfending", "Ko_KR.$utfending", "KO_KR.invalid", "zh_CN.$utfending"); + + // dump the name of the new locale set by setlocale() + var_dump($new_locale); + + // check that new locale setting is effective + // use localeconv() to get the details of currently set locale + $locale_info = localeconv(); + $new_currency = trim($locale_info['int_curr_symbol']); + + echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n"; + echo "Test "; + if( trim($currency_symbol[$new_locale]) == $new_currency) { + echo "PASSED.\n"; + } else { + echo "FAILED.\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing setlocale() by passing multiple valid/invalid locales as argument *** +-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) -- +string(%d) "%s" +Checking currency settings in the new locale, expected: %s, Found: %s +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_variation2.phpt b/tests/std/strings/setlocale_variation2.phpt new file mode 100644 index 00000000..a2225af7 --- /dev/null +++ b/tests/std/strings/setlocale_variation2.phpt @@ -0,0 +1,83 @@ +--TEST-- +Test setlocale() function : usage variations - Setting all available locales in the platform +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing setlocale() : usage variations *** +-- Test setlocale() with all available locale in the system -- +No of locales found on the machine = %d +No of setlocale() success = %d +Expected no of failures = 0 +Test PASSED +Done diff --git a/tests/std/strings/setlocale_variation3.phpt b/tests/std/strings/setlocale_variation3.phpt new file mode 100644 index 00000000..30f281a5 --- /dev/null +++ b/tests/std/strings/setlocale_variation3.phpt @@ -0,0 +1,145 @@ +--TEST-- +Test setlocale() function : usage variations - setting system locale = 0 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing setlocale() : usage variations - setting system locale = 0 *** +Locale info, before setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "USD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Setting system locale, category = LC_ALL and locale = 0 +Locale info, after setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "USD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Checking locale in the system, Expected : no change in the existing locale +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_variation4.phpt b/tests/std/strings/setlocale_variation4.phpt new file mode 100644 index 00000000..a2b236c1 --- /dev/null +++ b/tests/std/strings/setlocale_variation4.phpt @@ -0,0 +1,143 @@ +--TEST-- +Test setlocale() function : usage variations - setting system locale as null +--SKIPIF-- + +--ENV-- +LC_ALL=en_US.utf8; +--FILE-- + +--EXPECTF-- +*** Testing setlocale() : usage variations - Setting system locale = null *** +Locale info, before setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "AUD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Setting system locale, category = LC_ALL and locale = null +Locale info, after setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "USD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Checking new locale in the system, Expected : the locale names will be set from the values of environment variables +Test PASSED. +Done diff --git a/tests/std/strings/setlocale_variation5.phpt b/tests/std/strings/setlocale_variation5.phpt new file mode 100644 index 00000000..50c8a03b --- /dev/null +++ b/tests/std/strings/setlocale_variation5.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test setlocale() function : usage variations - Setting system locale as empty string +--SKIPIF-- + +--ENV-- +LC_ALL=en_US.utf8; +--FILE-- + +--EXPECTF-- +*** Testing setlocale() : usage variations - setting system locale = "" *** +Locale info, before setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "AUD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Setting system locale, category = LC_ALL and locale = "" +Locale info, after setting the locale +array(18) { + ["decimal_point"]=> + string(1) "." + ["thousands_sep"]=> + string(1) "," + ["int_curr_symbol"]=> + string(4) "USD " + ["currency_symbol"]=> + string(1) "$" + ["mon_decimal_point"]=> + string(1) "." + ["mon_thousands_sep"]=> + string(1) "," + ["positive_sign"]=> + string(0) "" + ["negative_sign"]=> + string(1) "-" + ["int_frac_digits"]=> + int(2) + ["frac_digits"]=> + int(2) + ["p_cs_precedes"]=> + int(1) + ["p_sep_by_space"]=> + int(0) + ["n_cs_precedes"]=> + int(1) + ["n_sep_by_space"]=> + int(0) + ["p_sign_posn"]=> + int(1) + ["n_sign_posn"]=> + int(1) + ["grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } + ["mon_grouping"]=> + array(%d) {%A + [%d]=> + int(3) + } +} +Checking new locale in the system, Expected : the locale names will be set from the values of environment variables +Test PASSED. +Done diff --git a/tests/std/strings/sha1.phpt b/tests/std/strings/sha1.phpt new file mode 100644 index 00000000..2fd9cfce --- /dev/null +++ b/tests/std/strings/sha1.phpt @@ -0,0 +1,55 @@ +--TEST-- +sha1() with ASCII output +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +bool(true) +string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1" +string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1" +bool(true) +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +bool(true) +string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83" +string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83" +bool(true) +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +bool(true) +string(20) "%a" +string(20) "%a" + +Warning: sha1_file(%ssha1.dat): Failed to open stream: No such file or directory in %s on line %d +Done diff --git a/tests/std/strings/sha1_basic.phpt b/tests/std/strings/sha1_basic.phpt new file mode 100644 index 00000000..bd8c448e --- /dev/null +++ b/tests/std/strings/sha1_basic.phpt @@ -0,0 +1,65 @@ +--TEST-- +sha1() with ASCII output. +--FILE-- + +--EXPECT-- +*** Testing sha1() : basic functionality *** + +-- Without raw argument -- +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3" +string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89" +string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940" +string(40) "50abf5706a150990a08b2c5ea40fa0e585554732" + +-- With raw == false -- +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3" +string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89" +string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940" +string(40) "50abf5706a150990a08b2c5ea40fa0e585554732" + +-- With raw == true -- +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" +string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8" +string(40) "a9993e364706816aba3e25717850c26c9cd0d89d" +string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3" +string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89" +string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940" +string(40) "50abf5706a150990a08b2c5ea40fa0e585554732" diff --git a/tests/std/strings/sha1_file.phpt b/tests/std/strings/sha1_file.phpt new file mode 100644 index 00000000..453ba56e --- /dev/null +++ b/tests/std/strings/sha1_file.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test sha1_file() function with ASCII output and raw binary output. Based on ext/standard/tests/strings/md5_file.phpt +--SKIPIF-- + +--FILE-- +getMessage() . \PHP_EOL; +} + +echo "\n-- invalid filename --\n"; +var_dump( sha1_file("rewncwYcn89q") ); + +echo "\n-- Scalar value as filename --\n"; +var_dump( sha1_file(12) ); + +echo "\n-- NULL as filename --\n"; +try { + var_dump( sha1_file(NULL) ); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} + +echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; +var_dump( sha1_file("EmptyFileSHA1.txt") ); + +echo "\n-- Raw Binary Output for Empty file as Argument --\n"; +var_dump( bin2hex(sha1_file("EmptyFileSHA1.txt", true))); + +echo "\n-- Hexadecimal Output for a valid file with some contents --\n"; +var_dump( sha1_file("DataFileSHA1.txt") ); + +echo "\n-- Raw Binary Output for a valid file with some contents --\n"; +var_dump ( bin2hex(sha1_file("DataFileSHA1.txt", true))); + +// remove temp files +unlink("DataFileSHA1.txt"); +unlink("EmptyFileSHA1.txt"); + +?> +--EXPECTF-- +*** Testing sha1_file() : basic functionality *** + +*** Testing for error conditions *** + +-- No filename -- +Path must not be empty + +-- invalid filename -- + +Warning: sha1_file(rewncwYcn89q): Failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- Scalar value as filename -- + +Warning: sha1_file(12): Failed to open stream: No such file or directory in %s on line %d +bool(false) + +-- NULL as filename -- + +Deprecated: sha1_file(): Passing null to parameter #1 ($filename) of type string is deprecated in %s on line %d +Path must not be empty + +-- Hexadecimal Output for Empty file as Argument -- +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" + +-- Raw Binary Output for Empty file as Argument -- +string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" + +-- Hexadecimal Output for a valid file with some contents -- +string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee" + +-- Raw Binary Output for a valid file with some contents -- +string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee" diff --git a/tests/std/strings/sha1raw.phpt b/tests/std/strings/sha1raw.phpt new file mode 100644 index 00000000..6777cab3 --- /dev/null +++ b/tests/std/strings/sha1raw.phpt @@ -0,0 +1,14 @@ +--TEST-- +sha1() with RAW output +--FILE-- + +--EXPECT-- +a9993e364706816aba3e25717850c26c9cd0d89d +84983e441c3bd26ebaae4aa1f95129e5e54670f1 +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 +e0c094e867ef46c350ef54a7f59dd60bed92ae83 diff --git a/tests/std/strings/show_source_basic.phpt b/tests/std/strings/show_source_basic.phpt new file mode 100644 index 00000000..ec7c26c0 --- /dev/null +++ b/tests/std/strings/show_source_basic.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test function show_source() by calling it with its expected arguments, more test for highlight_file() +--SKIPIF-- + +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + +--EXPECT-- +*** Test by calling method or function with its expected arguments *** +
<?php
+echo "*** Test by calling method or function with its expected arguments ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+  $baz = 'baz';
+}
+
+ /* some code here */
+
+show_source(__FILE__);
+
+?>
+
diff --git a/tests/std/strings/show_source_variation1.phpt b/tests/std/strings/show_source_variation1.phpt new file mode 100644 index 00000000..96cd6e8c --- /dev/null +++ b/tests/std/strings/show_source_variation1.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test function show_source() by calling it with its expected arguments and php output, more test for highlight_file() +--SKIPIF-- + +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + +--EXPECT-- +*** Test by calling method or function with its expected arguments and php output *** +baz +
<?php
+echo "*** Test by calling method or function with its expected arguments and php output ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+  $baz = "baz\n";
+}
+
+ /* some code here */
+echo $baz;
+show_source(__FILE__);
+echo $foo;
+?>
+
bar diff --git a/tests/std/strings/show_source_variation2.phpt b/tests/std/strings/show_source_variation2.phpt new file mode 100644 index 00000000..fc0fe2b0 --- /dev/null +++ b/tests/std/strings/show_source_variation2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test function show_source() by calling it with its expected arguments and output to variable, more test for highlight_file() +--SKIPIF-- + +--CREDITS-- +Francesco Fullone ff@ideato.it +#PHPTestFest Cesena Italia on 2009-06-20 +--FILE-- + +--EXPECT-- +*** Test by calling method or function with its expected arguments and output to variable *** +string(1705) "
<?php
+echo "*** Test by calling method or function with its expected arguments and output to variable ***\n";
+$foo = 'bar';
+$baz = "something ".$foo."\n";
+
+if ( $foo == 'bar' )
+{
+  $baz = "baz\n";
+}
+
+ /* some code here */
+$source = show_source(__FILE__, true);
+
+var_dump($source);
+?>
+
" diff --git a/tests/std/strings/similar_text_basic.phpt b/tests/std/strings/similar_text_basic.phpt new file mode 100644 index 00000000..5d5f15c6 --- /dev/null +++ b/tests/std/strings/similar_text_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +similar_text(), basic tests +--CREDITS-- +Mats Lindh +#Testfest php.no +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +int(3) +int(0) +int(1) +int(7) +float(54.54545454545455) +float(0) +float(18.181818181818183) +float(51.851851851851855) diff --git a/tests/std/strings/soundex.phpt b/tests/std/strings/soundex.phpt new file mode 100644 index 00000000..95d0b760 --- /dev/null +++ b/tests/std/strings/soundex.phpt @@ -0,0 +1,51 @@ +--TEST-- +soundex() tests +--FILE-- + +--EXPECT-- +string(4) "0000" +string(4) "0000" +string(4) "F650" +string(4) "T300" +string(4) "T500" +string(4) "O500" +string(4) "S500" +string(4) "T230" +string(4) "T300" +string(4) "H000" +string(4) "S523" +string(4) "A000" +string(4) "C520" +string(4) "I500" +string(4) "G450" +string(4) "A250" +string(4) "H256" +Done diff --git a/tests/std/strings/soundex_basic.phpt b/tests/std/strings/soundex_basic.phpt new file mode 100644 index 00000000..208265a4 --- /dev/null +++ b/tests/std/strings/soundex_basic.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test soundex() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing soundex() : basic functionality *** +string(4) "E460" +string(4) "G200" +string(4) "H416" +string(4) "K530" +string(4) "L300" +string(4) "L222" +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) diff --git a/tests/std/strings/sprintf_basic1.phpt b/tests/std/strings/sprintf_basic1.phpt new file mode 100644 index 00000000..23ac21de --- /dev/null +++ b/tests/std/strings/sprintf_basic1.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test sprintf() function : basic functionality - string format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using string format *** +string(6) "format" +string(13) "arg1 argument" +string(27) "arg1 argument arg2 argument" +string(41) "arg1 argument arg2 argument arg3 argument" +Done diff --git a/tests/std/strings/sprintf_basic2.phpt b/tests/std/strings/sprintf_basic2.phpt new file mode 100644 index 00000000..639545ac --- /dev/null +++ b/tests/std/strings/sprintf_basic2.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test sprintf() function : basic functionality - integer format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using integer format *** +string(6) "format" +string(3) "111" +string(7) "111 222" +string(11) "111 222 333" +Done diff --git a/tests/std/strings/sprintf_basic3.phpt b/tests/std/strings/sprintf_basic3.phpt new file mode 100644 index 00000000..d82097d1 --- /dev/null +++ b/tests/std/strings/sprintf_basic3.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test sprintf() function : basic functionality - float format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using float format *** +string(6) "format" +string(9) "11.110000" +string(9) "11.110000" +string(19) "11.110000 22.220000" +string(19) "11.110000 22.220000" +string(29) "11.110000 22.220000 33.330000" +string(29) "11.110000 22.220000 33.330000" +Done diff --git a/tests/std/strings/sprintf_basic4.phpt b/tests/std/strings/sprintf_basic4.phpt new file mode 100644 index 00000000..18a4b455 --- /dev/null +++ b/tests/std/strings/sprintf_basic4.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test sprintf() function : basic functionality - bool format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using bool format *** +string(6) "format" +string(1) "1" +string(3) "1 0" +string(5) "1 0 1" +Done diff --git a/tests/std/strings/sprintf_basic5.phpt b/tests/std/strings/sprintf_basic5.phpt new file mode 100644 index 00000000..0244524a --- /dev/null +++ b/tests/std/strings/sprintf_basic5.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test sprintf() function : basic functionality - char format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using char format *** +string(6) "format" +string(1) "A" +string(3) "A B" +string(5) "A B C" +Done diff --git a/tests/std/strings/sprintf_basic6.phpt b/tests/std/strings/sprintf_basic6.phpt new file mode 100644 index 00000000..99a85ddd --- /dev/null +++ b/tests/std/strings/sprintf_basic6.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test sprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using exponential format *** +string(6) "format" +string(11) "1.000000e+3" +string(23) "1.000000E+3 2.000000e+3" +string(35) "1.000000e+3 2.000000E+3 3.000000e+3" +Done diff --git a/tests/std/strings/sprintf_basic7.phpt b/tests/std/strings/sprintf_basic7.phpt new file mode 100644 index 00000000..77765aaf --- /dev/null +++ b/tests/std/strings/sprintf_basic7.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test sprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using unsigned format *** +string(6) "format" +string(10) "4294966185" +string(21) "4294966185 4293732729" +string(29) "4294966185 4293732729 2345432" +Done diff --git a/tests/std/strings/sprintf_basic7_64bit.phpt b/tests/std/strings/sprintf_basic7_64bit.phpt new file mode 100644 index 00000000..212800e5 --- /dev/null +++ b/tests/std/strings/sprintf_basic7_64bit.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test sprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using unsigned format *** +string(6) "format" +string(20) "18446744073709550505" +string(41) "18446744073709550505 18446744073708317049" +string(49) "18446744073709550505 18446744073708317049 2345432" +Done diff --git a/tests/std/strings/sprintf_basic8.phpt b/tests/std/strings/sprintf_basic8.phpt new file mode 100644 index 00000000..e9696db2 --- /dev/null +++ b/tests/std/strings/sprintf_basic8.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test sprintf() function : basic functionality - octal format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using octal format *** +string(6) "format" +string(2) "21" +string(14) "21 37777777431" +string(18) "21 37777777431 567" +Done diff --git a/tests/std/strings/sprintf_basic8_64bit.phpt b/tests/std/strings/sprintf_basic8_64bit.phpt new file mode 100644 index 00000000..528d82c6 --- /dev/null +++ b/tests/std/strings/sprintf_basic8_64bit.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test sprintf() function : basic functionality - octal format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using octal format *** +string(6) "format" +string(2) "21" +string(25) "21 1777777777777777777431" +string(29) "21 1777777777777777777431 567" +Done diff --git a/tests/std/strings/sprintf_basic9.phpt b/tests/std/strings/sprintf_basic9.phpt new file mode 100644 index 00000000..0f923f86 --- /dev/null +++ b/tests/std/strings/sprintf_basic9.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test sprintf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECT-- +*** Testing sprintf() : basic functionality - using hexadecimal format *** +string(6) "format" +string(1) "b" +string(1) "B" +string(4) "b 84" +string(4) "B 84" +string(7) "b 84 b1" +string(7) "B 84 B1" +Done diff --git a/tests/std/strings/sprintf_error.phpt b/tests/std/strings/sprintf_error.phpt new file mode 100644 index 00000000..7130e803 --- /dev/null +++ b/tests/std/strings/sprintf_error.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test sprintf() function : error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; +$format1 = '%s'; +$format2 = '%s%s'; +$format3 = '%s%s%s'; +$arg1 = 'one'; +$arg2 = 'two'; + +// with one argument less than expected +try { + var_dump( sprintf($format1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( sprintf($format2,$arg1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( sprintf($format3,$arg1,$arg2) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +// with two argument less than expected +try { + var_dump( sprintf($format2) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( sprintf($format3,$arg1) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +// with three argument less than expected +try { + var_dump( sprintf($format3) ); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump(sprintf('%100$d %d')); +} catch (\ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump(sprintf("foo %", 42)); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing sprintf() : error conditions *** + +-- Testing sprintf() function with Zero arguments -- +sprintf() expects at least 1 argument, 0 given + +-- Testing sprintf() function with less than expected no. of arguments -- +2 arguments are required, 1 given +3 arguments are required, 2 given +4 arguments are required, 3 given +3 arguments are required, 1 given +4 arguments are required, 2 given +4 arguments are required, 1 given +101 arguments are required, 1 given +Missing format specifier at end of string +Done diff --git a/tests/std/strings/sprintf_f.phpt b/tests/std/strings/sprintf_f.phpt new file mode 100644 index 00000000..6cba6d10 --- /dev/null +++ b/tests/std/strings/sprintf_f.phpt @@ -0,0 +1,40 @@ +--TEST-- +sprintf %f +--FILE-- + +--EXPECTF-- +string(4) "1.20" +string(4) "1.20" +string(4) "1.20" +string(4) "1.20" + +string(5) " 3.40" +string(5) "3.40 " +string(5) "03.40" +string(5) "3.400" + +string(7) " -5.60" +string(7) "-5.60 " +string(7) "-005.60" +string(7) "-5.6000" + +string(105) "1234567%d.0000" diff --git a/tests/std/strings/sprintf_f_2.phpt b/tests/std/strings/sprintf_f_2.phpt new file mode 100644 index 00000000..83157a7b --- /dev/null +++ b/tests/std/strings/sprintf_f_2.phpt @@ -0,0 +1,120 @@ +--TEST-- +sprintf %f #2 +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTREGEX-- +string\(7\) \"100\.426\" +string\(6\) \"100\.43\" +string\(3\) \"100\" +string\(3\) \"100\" +string\(3\) \"144\" +string\(3\) \"144\" +string\(34\) \"There are 100 monkeys in the world\" +string\(28\) \"The 100\.1 contains 0 monkeys\" +string\(30\) \"The world contains 100 monkeys\" +string\(76\) \"The world contains 100 monkeys. + That's a nice world full of 100 monkeys\.\" +string\(33\) \"%b = '10100111101010011010101101'\" +string\(8\) \"%c = 'A'\" +string\(15\) \"%d = '43951789'\" +string\(18\) \"%e = '4\.395179e\+7'\" +string\(15\) \"%u = '43951789'\" +(string\(17\) \"%u = '4251015507'\"|string\(27\) \"%u = '18446744073665599827'\") +string\(22\) \"%f = '43951789\.000000'\" +string\(16\) \"%o = '247523255'\" +string\(15\) \"%s = '43951789'\" +string\(14\) \"%x = '29ea6ad'\" +string\(14\) \"%X = '29EA6AD'\" +string\(17\) \"%\+d = '\+43951789'\" +string\(17\) \"%\+d = '-43951789'\" +string\(8\) \"\[monkey\]\" +string\(12\) \"\[ monkey\]\" +string\(12\) \"\[monkey \]\" +string\(12\) \"\[0000monkey\]\" +string\(12\) \"\[####monkey\]\" +string\(12\) \"\[many monke\]\" +string\(10\) \"2006-12-18\" +string\(6\) \"123\.10\" +string\(8\) \"3\.625e\+8\" diff --git a/tests/std/strings/sprintf_f_3.phpt b/tests/std/strings/sprintf_f_3.phpt new file mode 100644 index 00000000..38d580d4 --- /dev/null +++ b/tests/std/strings/sprintf_f_3.phpt @@ -0,0 +1,26 @@ +--TEST-- +sprintf %f #3 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(7) "100,426" +string(6) "100,43" +string(11) "100,426000'" +string(6) "123,10" +string(8) "1.231e+2" diff --git a/tests/std/strings/sprintf_rope_optimization_001.phpt b/tests/std/strings/sprintf_rope_optimization_001.phpt new file mode 100644 index 00000000..2f2736a8 --- /dev/null +++ b/tests/std/strings/sprintf_rope_optimization_001.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test sprintf() function : Rope Optimization +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(5) "const" + +string(3) "foo" + +string(7) "foo/bar" + +ArgumentCountError: 4 arguments are required, 3 given in %s:32 +Stack trace: +#0 %s(32): sprintf('%s/%s/%s', 'foo', 'bar') +#1 {main} + +Error: Object of class stdClass could not be converted to string in %s:36 +Stack trace: +#0 {main} + +string(4) "BAZ/" + +string(4) "/BAZ" + +string(5) "/BAZ/" + +string(12) "foobarBAZfoo" + +string(15) "foo:bar/BAZ-BAZ" + +Called! +string(3) "foo" + +string(%d) "%ssprintf_rope_optimization_001.php-%d-1" + +string(9) "abcdefghi" + +Called +Called +Called +Error: Object of class Foo could not be converted to string in %s:73 +Stack trace: +#0 {main} + +object(Closure)#3 (2) { + ["function"]=> + string(7) "sprintf" + ["parameter"]=> + array(2) { + ["$format"]=> + string(10) "" + ["$values"]=> + string(10) "" + } +} + +string(2) "%s" + +string(2) "%s" + + +Warning: Array to string conversion in %s on line 89 + +Warning: Array to string conversion in %s on line 89 + +Warning: Array to string conversion in %s on line 89 +string(17) "Array-Array-Array" + +string(0) "" + +ArgumentCountError: sprintf() expects at least 1 argument, 0 given in %s:97 +Stack trace: +#0 %s(97): sprintf() +#1 {main} + +string(4) "1--1" + +Done diff --git a/tests/std/strings/sprintf_rope_optimization_002.phpt b/tests/std/strings/sprintf_rope_optimization_002.phpt new file mode 100644 index 00000000..a6c71b81 --- /dev/null +++ b/tests/std/strings/sprintf_rope_optimization_002.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test sprintf() function : Rope Optimization with a throwing error handler. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Error: Object of class stdClass could not be converted to string in %s:13 +Stack trace: +#0 {main} + +Done diff --git a/tests/std/strings/sprintf_rope_optimization_003.phpt b/tests/std/strings/sprintf_rope_optimization_003.phpt new file mode 100644 index 00000000..ff1ab224 --- /dev/null +++ b/tests/std/strings/sprintf_rope_optimization_003.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test sprintf() function : Rope Optimization for '%d'. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(2) "42" + +string(8) "42/-1337" + +string(10) "42/-1337/3" + + +Warning: Object of class stdClass could not be converted to int in %s on line 33 +string(12) "42/-1337/3/1" + +string(2) "1/" + +string(2) "/1" + +string(3) "/1/" + +string(13) "42/-1337/1/42" + +string(8) "0/53/1/3" + +Called +Called +Called + +Warning: Object of class Foo could not be converted to int in %s on line 57 + +Warning: Object of class Foo could not be converted to int in %s on line 57 + +Warning: Object of class Foo could not be converted to int in %s on line 57 +string(5) "1/1/1" + +string(5) "0/0/0" + +string(42) "9223372036854775807/0/-9223372036854775808" +string(24) "2147483647/0/-2147483648" + +string(5) "1/0/1" + +string(3) "1/0" + +string(1) "0" + +Done diff --git a/tests/std/strings/sprintf_rope_optimization_004.phpt b/tests/std/strings/sprintf_rope_optimization_004.phpt new file mode 100644 index 00000000..27837e51 --- /dev/null +++ b/tests/std/strings/sprintf_rope_optimization_004.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test sprintf() function : Rope Optimization for '%d' with GMP objects +--EXTENSIONS-- +gmp +--FILE-- + +--EXPECTF-- +string(63) "42/-1337/4089650035136921599/1000000000000000000000000000000000" +string(54) "42/-1337/2147483647/1000000000000000000000000000000000" + +Done diff --git a/tests/std/strings/sprintf_star.phpt b/tests/std/strings/sprintf_star.phpt new file mode 100644 index 00000000..013b594b --- /dev/null +++ b/tests/std/strings/sprintf_star.phpt @@ -0,0 +1,116 @@ +--TEST-- +Star width and precision in sprintf() +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +try { + printf("%.*G\n", -100, 1.5); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + printf("%.*s\n", -1, "Foo"); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + printf("%*G\n", -1, $f); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + printf("%9999999999999999999999.f\n", $f); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +try { + printf("%.9999999999999999999999f\n", $f); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +float(1.2345678901234567) +float(1.2345678901234569E+100) +1.2345678901 +1.23456789 +1.2345678901234569e+100 +1.2345678901234569E+100 +1.2345678901234569e+100 +1.2345678901234569E+100 +foo + + 1.234568 + 1.23457 + foobar + + 1.235 + 1.23 + foo + +1.2345678901 +1.2345678901 +1.2345678901 + 1.234568 + 1.234568 + 1.234568 + 1.235 + 1.235 + 1.235 + +Precision must be an integer +Precision must be between -1 and 2147483647 +Precision -1 is only supported for %g, %G, %h and %H +Width must be between 0 and 2147483647 +Width must be between 0 and 2147483647 +Precision must be between 0 and 2147483647 diff --git a/tests/std/strings/sprintf_variation1.phpt b/tests/std/strings/sprintf_variation1.phpt new file mode 100644 index 00000000..4923830b --- /dev/null +++ b/tests/std/strings/sprintf_variation1.phpt @@ -0,0 +1,217 @@ +--TEST-- +Test sprintf() function : usage variations - unexpected values for format argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // resource data + $file_handle +); + +// loop through each element of the array for format + +$count = 1; +foreach($values as $value) { + echo "\n-- Iteration $count --\n"; + + // with default argument + try { + var_dump(sprintf($value)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + + // with two arguments + try { + var_dump(sprintf($value, $arg1)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + + // with three arguments + try { + var_dump(sprintf($value, $arg1, $arg2)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + + $count++; +} + +// close the resource +fclose($file_handle); + +echo "Done"; +?> +--EXPECT-- +*** Testing sprintf() : with unexpected values for format argument *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(1) "0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" +string(5) "12345" +string(5) "12345" + +-- Iteration 4 -- +string(5) "-2345" +string(5) "-2345" +string(5) "-2345" + +-- Iteration 5 -- +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" + +-- Iteration 6 -- +string(5) "-10.5" +string(5) "-10.5" +string(5) "-10.5" + +-- Iteration 7 -- +string(12) "101234567000" +string(12) "101234567000" +string(12) "101234567000" + +-- Iteration 8 -- +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" + +-- Iteration 9 -- +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" + +-- Iteration 10 -- +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given + +-- Iteration 11 -- +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given + +-- Iteration 12 -- +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given + +-- Iteration 13 -- +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given + +-- Iteration 14 -- +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given +sprintf(): Argument #1 ($format) must be of type string, array given + +-- Iteration 15 -- +string(1) "1" +string(1) "1" +string(1) "1" + +-- Iteration 16 -- +string(0) "" +string(0) "" +string(0) "" + +-- Iteration 17 -- +string(1) "1" +string(1) "1" +string(1) "1" + +-- Iteration 18 -- +string(0) "" +string(0) "" +string(0) "" + +-- Iteration 19 -- +string(0) "" +string(0) "" +string(0) "" + +-- Iteration 20 -- +string(0) "" +string(0) "" +string(0) "" + +-- Iteration 21 -- +string(6) "Object" +string(6) "Object" +string(6) "Object" + +-- Iteration 22 -- +sprintf(): Argument #1 ($format) must be of type string, resource given +sprintf(): Argument #1 ($format) must be of type string, resource given +sprintf(): Argument #1 ($format) must be of type string, resource given +Done diff --git a/tests/std/strings/sprintf_variation10.phpt b/tests/std/strings/sprintf_variation10.phpt new file mode 100644 index 00000000..5a62047e --- /dev/null +++ b/tests/std/strings/sprintf_variation10.phpt @@ -0,0 +1,248 @@ +--TEST-- +Test sprintf() function : usage variations - float formats with integer values +--FILE-- + +--EXPECT-- +*** Testing sprintf() : float formats with integer values *** + +-- Iteration 1 -- +string(8) "0.000000" +string(8) "0.000000" +string(9) " 0.000000" +string(9) "0.000000 " +string(9) " 0.000000" +string(9) " +0.000000" +string(8) "0.000000" +string(30) " 0.000000" + +-- Iteration 2 -- +string(8) "1.000000" +string(8) "1.000000" +string(9) " 1.000000" +string(9) "1.000000 " +string(9) " 1.000000" +string(9) " +1.000000" +string(8) "1.000000" +string(30) " 1.000000" + +-- Iteration 3 -- +string(9) "-1.000000" +string(9) "-1.000000" +string(10) " -1.000000" +string(10) "-1.000000 " +string(10) " -1.000000" +string(10) " +-1.000000" +string(9) "-1.000000" +string(30) " -1.000000" + +-- Iteration 4 -- +string(18) "-2147483648.000000" +string(18) "-2147483648.000000" +string(19) " -2147483648.000000" +string(19) "-2147483648.000000 " +string(19) " -2147483648.000000" +string(19) " +-2147483648.000000" +string(18) "-2147483648.000000" +string(30) " -2147483648.000000" + +-- Iteration 5 -- +string(18) "-2147483647.000000" +string(18) "-2147483647.000000" +string(19) " -2147483647.000000" +string(19) "-2147483647.000000 " +string(19) " -2147483647.000000" +string(19) " +-2147483647.000000" +string(18) "-2147483647.000000" +string(30) " -2147483647.000000" + +-- Iteration 6 -- +string(17) "2147483647.000000" +string(17) "2147483647.000000" +string(18) " 2147483647.000000" +string(18) "2147483647.000000 " +string(18) " 2147483647.000000" +string(18) " +2147483647.000000" +string(17) "2147483647.000000" +string(30) " 2147483647.000000" + +-- Iteration 7 -- +string(17) "2147483640.000000" +string(17) "2147483640.000000" +string(18) " 2147483640.000000" +string(18) "2147483640.000000 " +string(18) " 2147483640.000000" +string(18) " +2147483640.000000" +string(17) "2147483640.000000" +string(30) " 2147483640.000000" + +-- Iteration 8 -- +string(11) "4667.000000" +string(11) "4667.000000" +string(12) " 4667.000000" +string(12) "4667.000000 " +string(12) " 4667.000000" +string(12) " +4667.000000" +string(11) "4667.000000" +string(30) " 4667.000000" + +-- Iteration 9 -- +string(11) "4779.000000" +string(11) "4779.000000" +string(12) " 4779.000000" +string(12) "4779.000000 " +string(12) " 4779.000000" +string(12) " +4779.000000" +string(11) "4779.000000" +string(30) " 4779.000000" + +-- Iteration 10 -- +string(11) "4095.000000" +string(11) "4095.000000" +string(12) " 4095.000000" +string(12) "4095.000000 " +string(12) " 4095.000000" +string(12) " +4095.000000" +string(11) "4095.000000" +string(30) " 4095.000000" + +-- Iteration 11 -- +string(10) "250.000000" +string(10) "250.000000" +string(11) " 250.000000" +string(11) "250.000000 " +string(11) " 250.000000" +string(11) " +250.000000" +string(10) "250.000000" +string(30) " 250.000000" + +-- Iteration 12 -- +string(18) "-2147483648.000000" +string(18) "-2147483648.000000" +string(19) " -2147483648.000000" +string(19) "-2147483648.000000 " +string(19) " -2147483648.000000" +string(19) " +-2147483648.000000" +string(18) "-2147483648.000000" +string(30) " -2147483648.000000" + +-- Iteration 13 -- +string(17) "2147483647.000000" +string(17) "2147483647.000000" +string(18) " 2147483647.000000" +string(18) "2147483647.000000 " +string(18) " 2147483647.000000" +string(18) " +2147483647.000000" +string(17) "2147483647.000000" +string(30) " 2147483647.000000" + +-- Iteration 14 -- +string(17) "2147483647.000000" +string(17) "2147483647.000000" +string(18) " 2147483647.000000" +string(18) "2147483647.000000 " +string(18) " 2147483647.000000" +string(18) " +2147483647.000000" +string(17) "2147483647.000000" +string(30) " 2147483647.000000" + +-- Iteration 15 -- +string(9) "83.000000" +string(9) "83.000000" +string(10) " 83.000000" +string(10) "83.000000 " +string(10) " 83.000000" +string(10) " +83.000000" +string(9) "83.000000" +string(30) " 83.000000" + +-- Iteration 16 -- +string(8) "1.000000" +string(8) "1.000000" +string(9) " 1.000000" +string(9) "1.000000 " +string(9) " 1.000000" +string(9) " +1.000000" +string(8) "1.000000" +string(30) " 1.000000" + +-- Iteration 17 -- +string(18) "-2147483648.000000" +string(18) "-2147483648.000000" +string(19) " -2147483648.000000" +string(19) "-2147483648.000000 " +string(19) " -2147483648.000000" +string(19) " +-2147483648.000000" +string(18) "-2147483648.000000" +string(30) " -2147483648.000000" + +-- Iteration 18 -- +string(17) "2147483647.000000" +string(17) "2147483647.000000" +string(18) " 2147483647.000000" +string(18) "2147483647.000000 " +string(18) " 2147483647.000000" +string(18) " +2147483647.000000" +string(17) "2147483647.000000" +string(30) " 2147483647.000000" +Done diff --git a/tests/std/strings/sprintf_variation15.phpt b/tests/std/strings/sprintf_variation15.phpt new file mode 100644 index 00000000..3b1abe75 --- /dev/null +++ b/tests/std/strings/sprintf_variation15.phpt @@ -0,0 +1,331 @@ +--TEST-- +Test sprintf() function : usage variations - string formats with string values +--FILE-- + +--EXPECTF-- +*** Testing sprintf() : string formats with string values *** + +-- Iteration 1 -- +string(0) "" +string(0) "" +string(1) " " +string(1) " " +string(1) " " +string(1) " +" +string(4) " " +string(30) " " + +-- Iteration 2 -- +string(1) " " +string(1) " " +string(2) " " +string(2) " " +string(2) " " +string(2) " + " +string(4) " " +string(30) " " + +-- Iteration 3 -- +string(0) "" +string(0) "" +string(1) " " +string(1) " " +string(1) " " +string(1) " +" +string(4) " " +string(30) " " + +-- Iteration 4 -- +string(1) " " +string(1) " " +string(2) " " +string(2) " " +string(2) " " +string(2) " + " +string(4) " " +string(30) " " + +-- Iteration 5 -- +string(6) "string" +string(6) "string" +string(7) " string" +string(7) "string " +string(7) " string" +string(7) " +string" +string(6) "string" +string(30) " string" + +-- Iteration 6 -- +string(6) "string" +string(6) "string" +string(7) " string" +string(7) "string " +string(7) " string" +string(7) " +string" +string(6) "string" +string(30) " string" + +-- Iteration 7 -- +string(4) "NULL" +string(4) "NULL" +string(5) " NULL" +string(5) "NULL " +string(5) " NULL" +string(5) " +NULL" +string(4) "NULL" +string(30) " NULL" + +-- Iteration 8 -- +string(4) "null" +string(4) "null" +string(5) " null" +string(5) "null " +string(5) " null" +string(5) " +null" +string(4) "null" +string(30) " null" + +-- Iteration 9 -- +string(5) "FALSE" +string(5) "FALSE" +string(6) " FALSE" +string(6) "FALSE " +string(6) " FALSE" +string(6) " +FALSE" +string(5) "FALSE" +string(30) " FALSE" + +-- Iteration 10 -- +string(4) "true" +string(4) "true" +string(5) " true" +string(5) "true " +string(5) " true" +string(5) " +true" +string(4) "true" +string(30) " true" + +-- Iteration 11 -- +string(1) " " +string(1) " " +string(2) " " +string(2) " " +string(2) " " +string(2) " + " +string(4) " " +string(30) " " + +-- Iteration 12 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(4) " %0" +string(30) " %0" + +-- Iteration 13 -- +string(2) "\0" +string(2) "\0" +string(3) " \0" +string(3) "\0 " +string(3) " \0" +string(3) " +\0" +string(4) " \0" +string(30) " \0" + +-- Iteration 14 -- +string(4) "\060" +string(4) "\060" +string(5) " \060" +string(5) "\060 " +string(5) " \060" +string(5) " +\060" +string(4) "\060" +string(30) " \060" + +-- Iteration 15 -- +string(1) "8" +string(1) "8" +string(2) " 8" +string(2) "8 " +string(2) " 8" +string(2) " +8" +string(4) " 8" +string(30) " 8" + +-- Iteration 16 -- +string(5) "0x55F" +string(5) "0x55F" +string(6) " 0x55F" +string(6) "0x55F " +string(6) " 0x55F" +string(6) " +0x55F" +string(5) "0x55F" +string(30) " 0x55F" + +-- Iteration 17 -- +string(3) "055" +string(3) "055" +string(4) " 055" +string(4) "055 " +string(4) " 055" +string(4) " +055" +string(4) " 055" +string(30) " 055" + +-- Iteration 18 -- +string(18) "@#$#$%%$^^$%^%^$^&" +string(18) "@#$#$%%$^^$%^%^$^&" +string(19) " @#$#$%%$^^$%^%^$^&" +string(19) "@#$#$%%$^^$%^%^$^& " +string(19) " @#$#$%%$^^$%^%^$^&" +string(19) " +@#$#$%%$^^$%^%^$^&" +string(18) "@#$#$%%$^^$%^%^$^&" +string(30) " @#$#$%%$^^$%^%^$^&" + +-- Iteration 19 -- +string(37) "This is string defined +using heredoc." +string(37) "This is string defined +using heredoc." +string(38) " This is string defined +using heredoc." +string(38) "This is string defined +using heredoc. " +string(38) " This is string defined +using heredoc." +string(38) " +This is string defined +using heredoc." +string(37) "This is string defined +using heredoc." +string(37) "This is string defined +using heredoc." + +-- Iteration 20 -- +string(23) "123456 3993 +4849 string" +string(23) "123456 3993 +4849 string" +string(24) " 123456 3993 +4849 string" +string(24) "123456 3993 +4849 string " +string(24) " 123456 3993 +4849 string" +string(24) " +123456 3993 +4849 string" +string(23) "123456 3993 +4849 string" +string(30) " 123456 3993 +4849 string" + +-- Iteration 21 -- +string(0) "" +string(0) "" +string(1) " " +string(1) " " +string(1) " " +string(1) " +" +string(4) " " +string(30) " " + +-- Iteration 22 -- +string(4) "NULL" +string(4) "NULL" +string(5) " NULL" +string(5) "NULL " +string(5) " NULL" +string(5) " +NULL" +string(4) "NULL" +string(30) " NULL" +Done diff --git a/tests/std/strings/sprintf_variation2.phpt b/tests/std/strings/sprintf_variation2.phpt new file mode 100644 index 00000000..ec089c5d --- /dev/null +++ b/tests/std/strings/sprintf_variation2.phpt @@ -0,0 +1,238 @@ +--TEST-- +Test sprintf() function : usage variations - with all types of values for arg1 argument +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new sample(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource data + $file_handle +); + +// loop through each element of the array for arg1 + +$count = 1; +foreach($values as $value) { + echo "\n-- Iteration $count --\n"; + + // with two arguments + var_dump( sprintf($format, $value) ); + + // with three arguments + var_dump( sprintf($format, $value, $arg2) ); + + $count++; +}; + +// closing the resource +fclose($file_handle); + +echo "Done"; +?> +--EXPECTF-- +*** Testing sprintf() : with different types of values passed for arg1 argument *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" +string(5) "12345" + +-- Iteration 4 -- +string(5) "-2345" +string(5) "-2345" + +-- Iteration 5 -- +string(4) "10.5" +string(4) "10.5" + +-- Iteration 6 -- +string(5) "-10.5" +string(5) "-10.5" + +-- Iteration 7 -- +string(12) "101234567000" +string(12) "101234567000" + +-- Iteration 8 -- +string(13) "1.07654321E-9" +string(13) "1.07654321E-9" + +-- Iteration 9 -- +string(3) "0.5" +string(3) "0.5" + +-- Iteration 10 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 11 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 12 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 13 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 14 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 15 -- +string(0) "" +string(0) "" + +-- Iteration 16 -- +string(0) "" +string(0) "" + +-- Iteration 17 -- +string(1) "1" +string(1) "1" + +-- Iteration 18 -- +string(0) "" +string(0) "" + +-- Iteration 19 -- +string(1) "1" +string(1) "1" + +-- Iteration 20 -- +string(0) "" +string(0) "" + +-- Iteration 21 -- +string(0) "" +string(0) "" + +-- Iteration 22 -- +string(0) "" +string(0) "" + +-- Iteration 23 -- +string(6) "string" +string(6) "string" + +-- Iteration 24 -- +string(6) "string" +string(6) "string" + +-- Iteration 25 -- +string(6) "Object" +string(6) "Object" + +-- Iteration 26 -- +string(0) "" +string(0) "" + +-- Iteration 27 -- +string(0) "" +string(0) "" + +-- Iteration 28 -- +string(%d) "Resource id #%d" +string(%d) "Resource id #%d" +Done diff --git a/tests/std/strings/sprintf_variation27.phpt b/tests/std/strings/sprintf_variation27.phpt new file mode 100644 index 00000000..0d4516e0 --- /dev/null +++ b/tests/std/strings/sprintf_variation27.phpt @@ -0,0 +1,129 @@ +--TEST-- +Test sprintf() function : usage variations - char formats with char values +--FILE-- + +--EXPECTF-- +*** Testing sprintf() : char formats with char values *** + +-- Iteration 1 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" + +-- Iteration 2 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" + +-- Iteration 3 -- +string(1) "C" +string(1) "C" +string(2) " C" +string(2) "C " +string(2) " C" +string(2) " +C" +string(1) "C" +string(1) "C" + +-- Iteration 4 -- +string(1) "½" +string(1) "½" +string(2) " ½" +string(2) "½ " +string(2) " ½" +string(2) " +½" +string(1) "½" +string(1) "½" + +-- Iteration 5 -- +string(1) "c" +string(1) "c" +string(2) " c" +string(2) "c " +string(2) " c" +string(2) " +c" +string(1) "c" +string(1) "c" + +-- Iteration 6 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" + +-- Iteration 7 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" + +-- Iteration 8 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" + +-- Iteration 9 -- +string(1) "%0" +string(1) "%0" +string(2) " %0" +string(2) "%0 " +string(2) " %0" +string(2) " +%0" +string(1) "%0" +string(1) "%0" +Done diff --git a/tests/std/strings/sprintf_variation28.phpt b/tests/std/strings/sprintf_variation28.phpt new file mode 100644 index 00000000..4903d3ed --- /dev/null +++ b/tests/std/strings/sprintf_variation28.phpt @@ -0,0 +1,253 @@ +--TEST-- +Test sprintf() function : usage variations - octal formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : octal formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(11) "37777777777" +string(11) "37777777777" +string(12) " 37777777777" +string(12) "37777777777 " +string(12) " 37777777777" +string(12) " +37777777777" +string(11) "37777777777" +string(30) " 37777777777" + +-- Iteration 4 -- +string(11) "20000000000" +string(11) "20000000000" +string(12) " 20000000000" +string(12) "20000000000 " +string(12) " 20000000000" +string(12) " +20000000000" +string(11) "20000000000" +string(30) " 20000000000" + +-- Iteration 5 -- +string(11) "20000000001" +string(11) "20000000001" +string(12) " 20000000001" +string(12) "20000000001 " +string(12) " 20000000001" +string(12) " +20000000001" +string(11) "20000000001" +string(30) " 20000000001" + +-- Iteration 6 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 7 -- +string(11) "17777777770" +string(11) "17777777770" +string(12) " 17777777770" +string(12) "17777777770 " +string(12) " 17777777770" +string(12) " +17777777770" +string(11) "17777777770" +string(30) " 17777777770" + +-- Iteration 8 -- +string(5) "11073" +string(5) "11073" +string(6) " 11073" +string(6) "11073 " +string(6) " 11073" +string(6) " +11073" +string(5) "11073" +string(30) " 11073" + +-- Iteration 9 -- +string(5) "11253" +string(5) "11253" +string(6) " 11253" +string(6) "11253 " +string(6) " 11253" +string(6) " +11253" +string(5) "11253" +string(30) " 11253" + +-- Iteration 10 -- +string(4) "7777" +string(4) "7777" +string(5) " 7777" +string(5) "7777 " +string(5) " 7777" +string(5) " +7777" +string(4) "7777" +string(30) " 7777" + +-- Iteration 11 -- +string(3) "372" +string(3) "372" +string(4) " 372" +string(4) "372 " +string(4) " 372" +string(4) " +372" +string(4) " 372" +string(30) " 372" + +-- Iteration 12 -- +string(11) "20000000000" +string(11) "20000000000" +string(12) " 20000000000" +string(12) "20000000000 " +string(12) " 20000000000" +string(12) " +20000000000" +string(11) "20000000000" +string(30) " 20000000000" + +-- Iteration 13 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 14 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 15 -- +string(3) "123" +string(3) "123" +string(4) " 123" +string(4) "123 " +string(4) " 123" +string(4) " +123" +string(4) " 123" +string(30) " 123" + +-- Iteration 16 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(11) "20000000000" +string(11) "20000000000" +string(12) " 20000000000" +string(12) "20000000000 " +string(12) " 20000000000" +string(12) " +20000000000" +string(11) "20000000000" +string(30) " 20000000000" + +-- Iteration 18 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" +Done diff --git a/tests/std/strings/sprintf_variation28_64bit.phpt b/tests/std/strings/sprintf_variation28_64bit.phpt new file mode 100644 index 00000000..331cb4be --- /dev/null +++ b/tests/std/strings/sprintf_variation28_64bit.phpt @@ -0,0 +1,249 @@ +--TEST-- +Test sprintf() function : usage variations - octal formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : octal formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(22) "1777777777777777777777" +string(22) "1777777777777777777777" +string(23) " 1777777777777777777777" +string(23) "1777777777777777777777 " +string(23) " 1777777777777777777777" +string(23) " +1777777777777777777777" +string(22) "1777777777777777777777" +string(30) " 1777777777777777777777" + +-- Iteration 4 -- +string(22) "1777777777760000000000" +string(22) "1777777777760000000000" +string(23) " 1777777777760000000000" +string(23) "1777777777760000000000 " +string(23) " 1777777777760000000000" +string(23) " +1777777777760000000000" +string(22) "1777777777760000000000" +string(30) " 1777777777760000000000" + +-- Iteration 5 -- +string(22) "1777777777760000000001" +string(22) "1777777777760000000001" +string(23) " 1777777777760000000001" +string(23) "1777777777760000000001 " +string(23) " 1777777777760000000001" +string(23) " +1777777777760000000001" +string(22) "1777777777760000000001" +string(30) " 1777777777760000000001" + +-- Iteration 6 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 7 -- +string(11) "17777777770" +string(11) "17777777770" +string(12) " 17777777770" +string(12) "17777777770 " +string(12) " 17777777770" +string(12) " +17777777770" +string(11) "17777777770" +string(30) " 17777777770" + +-- Iteration 8 -- +string(5) "11073" +string(5) "11073" +string(6) " 11073" +string(6) "11073 " +string(6) " 11073" +string(6) " +11073" +string(5) "11073" +string(30) " 11073" + +-- Iteration 9 -- +string(5) "11253" +string(5) "11253" +string(6) " 11253" +string(6) "11253 " +string(6) " 11253" +string(6) " +11253" +string(5) "11253" +string(30) " 11253" + +-- Iteration 10 -- +string(4) "7777" +string(4) "7777" +string(5) " 7777" +string(5) "7777 " +string(5) " 7777" +string(5) " +7777" +string(4) "7777" +string(30) " 7777" + +-- Iteration 11 -- +string(3) "372" +string(3) "372" +string(4) " 372" +string(4) "372 " +string(4) " 372" +string(4) " +372" +string(4) " 372" +string(30) " 372" + +-- Iteration 12 -- +string(22) "1777777777760000000000" +string(22) "1777777777760000000000" +string(23) " 1777777777760000000000" +string(23) "1777777777760000000000 " +string(23) " 1777777777760000000000" +string(23) " +1777777777760000000000" +string(22) "1777777777760000000000" +string(30) " 1777777777760000000000" + +-- Iteration 13 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 14 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" + +-- Iteration 15 -- +string(3) "123" +string(3) "123" +string(4) " 123" +string(4) "123 " +string(4) " 123" +string(4) " +123" +string(4) " 123" +string(30) " 123" + +-- Iteration 16 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(22) "1777777777760000000000" +string(22) "1777777777760000000000" +string(23) " 1777777777760000000000" +string(23) "1777777777760000000000 " +string(23) " 1777777777760000000000" +string(23) " +1777777777760000000000" +string(22) "1777777777760000000000" +string(30) " 1777777777760000000000" + +-- Iteration 18 -- +string(11) "17777777777" +string(11) "17777777777" +string(12) " 17777777777" +string(12) "17777777777 " +string(12) " 17777777777" +string(12) " +17777777777" +string(11) "17777777777" +string(30) " 17777777777" +Done diff --git a/tests/std/strings/sprintf_variation3.phpt b/tests/std/strings/sprintf_variation3.phpt new file mode 100644 index 00000000..e82adc7a --- /dev/null +++ b/tests/std/strings/sprintf_variation3.phpt @@ -0,0 +1,246 @@ +--TEST-- +Test sprintf() function : usage variations - int formats with int values +--FILE-- + +--EXPECT-- +*** Testing sprintf() : integer formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(2) "-1" +string(2) "-1" +string(3) " -1" +string(3) "-1 " +string(3) " -1" +string(3) " +-1" +string(4) " -1" +string(30) " -1" + +-- Iteration 4 -- +string(11) "-2147483648" +string(11) "-2147483648" +string(12) " -2147483648" +string(12) "-2147483648 " +string(12) " -2147483648" +string(12) " +-2147483648" +string(11) "-2147483648" +string(30) " -2147483648" + +-- Iteration 5 -- +string(11) "-2147483647" +string(11) "-2147483647" +string(12) " -2147483647" +string(12) "-2147483647 " +string(12) " -2147483647" +string(12) " +-2147483647" +string(11) "-2147483647" +string(30) " -2147483647" + +-- Iteration 6 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 7 -- +string(10) "2147483640" +string(10) "2147483640" +string(11) " 2147483640" +string(11) "2147483640 " +string(11) " 2147483640" +string(11) " +2147483640" +string(10) "2147483640" +string(30) " 2147483640" + +-- Iteration 8 -- +string(4) "4667" +string(4) "4667" +string(5) " 4667" +string(5) "4667 " +string(5) " 4667" +string(5) " +4667" +string(4) "4667" +string(30) " 4667" + +-- Iteration 9 -- +string(4) "4779" +string(4) "4779" +string(5) " 4779" +string(5) "4779 " +string(5) " 4779" +string(5) " +4779" +string(4) "4779" +string(30) " 4779" + +-- Iteration 10 -- +string(4) "4095" +string(4) "4095" +string(5) " 4095" +string(5) "4095 " +string(5) " 4095" +string(5) " +4095" +string(4) "4095" +string(30) " 4095" + +-- Iteration 11 -- +string(3) "250" +string(3) "250" +string(4) " 250" +string(4) "250 " +string(4) " 250" +string(4) " +250" +string(4) " 250" +string(30) " 250" + +-- Iteration 12 -- +string(11) "-2147483648" +string(11) "-2147483648" +string(12) " -2147483648" +string(12) "-2147483648 " +string(12) " -2147483648" +string(12) " +-2147483648" +string(11) "-2147483648" +string(30) " -2147483648" + +-- Iteration 13 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 14 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 15 -- +string(2) "83" +string(2) "83" +string(3) " 83" +string(3) "83 " +string(3) " 83" +string(3) " +83" +string(4) " 83" +string(30) " 83" + +-- Iteration 16 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(11) "-2147483648" +string(11) "-2147483648" +string(12) " -2147483648" +string(12) "-2147483648 " +string(12) " -2147483648" +string(12) " +-2147483648" +string(11) "-2147483648" +string(30) " -2147483648" + +-- Iteration 18 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" +Done diff --git a/tests/std/strings/sprintf_variation34.phpt b/tests/std/strings/sprintf_variation34.phpt new file mode 100644 index 00000000..c7ff681f --- /dev/null +++ b/tests/std/strings/sprintf_variation34.phpt @@ -0,0 +1,271 @@ +--TEST-- +Test sprintf() function : usage variations - hexa formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : hexa formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(2) "0x" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(2) "1x" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(8) "ffffffff" +string(9) "ffffffffx" +string(8) "ffffffff" +string(9) " ffffffff" +string(9) "ffffffff " +string(9) " ffffffff" +string(9) " +ffffffff" +string(8) "ffffffff" +string(30) " ffffffff" + +-- Iteration 4 -- +string(8) "80000000" +string(9) "80000000x" +string(8) "80000000" +string(9) " 80000000" +string(9) "80000000 " +string(9) " 80000000" +string(9) " +80000000" +string(8) "80000000" +string(30) " 80000000" + +-- Iteration 5 -- +string(8) "80000001" +string(9) "80000001x" +string(8) "80000001" +string(9) " 80000001" +string(9) "80000001 " +string(9) " 80000001" +string(9) " +80000001" +string(8) "80000001" +string(30) " 80000001" + +-- Iteration 6 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 7 -- +string(8) "7ffffff8" +string(9) "7ffffff8x" +string(8) "7ffffff8" +string(9) " 7ffffff8" +string(9) "7ffffff8 " +string(9) " 7ffffff8" +string(9) " +7ffffff8" +string(8) "7ffffff8" +string(30) " 7ffffff8" + +-- Iteration 8 -- +string(4) "123b" +string(5) "123bx" +string(4) "123b" +string(5) " 123b" +string(5) "123b " +string(5) " 123b" +string(5) " +123b" +string(4) "123b" +string(30) " 123b" + +-- Iteration 9 -- +string(4) "12ab" +string(5) "12abx" +string(4) "12ab" +string(5) " 12ab" +string(5) "12ab " +string(5) " 12ab" +string(5) " +12ab" +string(4) "12ab" +string(30) " 12ab" + +-- Iteration 10 -- +string(3) "fff" +string(4) "fffx" +string(3) "fff" +string(4) " fff" +string(4) "fff " +string(4) " fff" +string(4) " +fff" +string(4) " fff" +string(30) " fff" + +-- Iteration 11 -- +string(2) "fa" +string(3) "fax" +string(2) "fa" +string(3) " fa" +string(3) "fa " +string(3) " fa" +string(3) " +fa" +string(4) " fa" +string(30) " fa" + +-- Iteration 12 -- +string(8) "80000000" +string(9) "80000000x" +string(8) "80000000" +string(9) " 80000000" +string(9) "80000000 " +string(9) " 80000000" +string(9) " +80000000" +string(8) "80000000" +string(30) " 80000000" + +-- Iteration 13 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 14 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 15 -- +string(2) "53" +string(3) "53x" +string(2) "53" +string(3) " 53" +string(3) "53 " +string(3) " 53" +string(3) " +53" +string(4) " 53" +string(30) " 53" + +-- Iteration 16 -- +string(1) "1" +string(2) "1x" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(8) "80000000" +string(9) "80000000x" +string(8) "80000000" +string(9) " 80000000" +string(9) "80000000 " +string(9) " 80000000" +string(9) " +80000000" +string(8) "80000000" +string(30) " 80000000" + +-- Iteration 18 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" +Done diff --git a/tests/std/strings/sprintf_variation34_64bit.phpt b/tests/std/strings/sprintf_variation34_64bit.phpt new file mode 100644 index 00000000..aaaca438 --- /dev/null +++ b/tests/std/strings/sprintf_variation34_64bit.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test sprintf() function : usage variations - hexa formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : hexa formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(2) "0x" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(2) "1x" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(16) "ffffffffffffffff" +string(17) "ffffffffffffffffx" +string(16) "ffffffffffffffff" +string(17) " ffffffffffffffff" +string(17) "ffffffffffffffff " +string(17) " ffffffffffffffff" +string(17) " +ffffffffffffffff" +string(16) "ffffffffffffffff" +string(30) " ffffffffffffffff" + +-- Iteration 4 -- +string(16) "ffffffff80000000" +string(17) "ffffffff80000000x" +string(16) "ffffffff80000000" +string(17) " ffffffff80000000" +string(17) "ffffffff80000000 " +string(17) " ffffffff80000000" +string(17) " +ffffffff80000000" +string(16) "ffffffff80000000" +string(30) " ffffffff80000000" + +-- Iteration 5 -- +string(16) "ffffffff80000001" +string(17) "ffffffff80000001x" +string(16) "ffffffff80000001" +string(17) " ffffffff80000001" +string(17) "ffffffff80000001 " +string(17) " ffffffff80000001" +string(17) " +ffffffff80000001" +string(16) "ffffffff80000001" +string(30) " ffffffff80000001" + +-- Iteration 6 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 7 -- +string(8) "7ffffff8" +string(9) "7ffffff8x" +string(8) "7ffffff8" +string(9) " 7ffffff8" +string(9) "7ffffff8 " +string(9) " 7ffffff8" +string(9) " +7ffffff8" +string(8) "7ffffff8" +string(30) " 7ffffff8" + +-- Iteration 8 -- +string(4) "123b" +string(5) "123bx" +string(4) "123b" +string(5) " 123b" +string(5) "123b " +string(5) " 123b" +string(5) " +123b" +string(4) "123b" +string(30) " 123b" + +-- Iteration 9 -- +string(4) "12ab" +string(5) "12abx" +string(4) "12ab" +string(5) " 12ab" +string(5) "12ab " +string(5) " 12ab" +string(5) " +12ab" +string(4) "12ab" +string(30) " 12ab" + +-- Iteration 10 -- +string(3) "fff" +string(4) "fffx" +string(3) "fff" +string(4) " fff" +string(4) "fff " +string(4) " fff" +string(4) " +fff" +string(4) " fff" +string(30) " fff" + +-- Iteration 11 -- +string(2) "fa" +string(3) "fax" +string(2) "fa" +string(3) " fa" +string(3) "fa " +string(3) " fa" +string(3) " +fa" +string(4) " fa" +string(30) " fa" + +-- Iteration 12 -- +string(16) "ffffffff80000000" +string(17) "ffffffff80000000x" +string(16) "ffffffff80000000" +string(17) " ffffffff80000000" +string(17) "ffffffff80000000 " +string(17) " ffffffff80000000" +string(17) " +ffffffff80000000" +string(16) "ffffffff80000000" +string(30) " ffffffff80000000" + +-- Iteration 13 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 14 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" + +-- Iteration 15 -- +string(2) "53" +string(3) "53x" +string(2) "53" +string(3) " 53" +string(3) "53 " +string(3) " 53" +string(3) " +53" +string(4) " 53" +string(30) " 53" + +-- Iteration 16 -- +string(1) "1" +string(2) "1x" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(16) "ffffffff80000000" +string(17) "ffffffff80000000x" +string(16) "ffffffff80000000" +string(17) " ffffffff80000000" +string(17) "ffffffff80000000 " +string(17) " ffffffff80000000" +string(17) " +ffffffff80000000" +string(16) "ffffffff80000000" +string(30) " ffffffff80000000" + +-- Iteration 18 -- +string(8) "7fffffff" +string(9) "7fffffffx" +string(8) "7fffffff" +string(9) " 7fffffff" +string(9) "7fffffff " +string(9) " 7fffffff" +string(9) " +7fffffff" +string(8) "7fffffff" +string(30) " 7fffffff" +Done diff --git a/tests/std/strings/sprintf_variation4.phpt b/tests/std/strings/sprintf_variation4.phpt new file mode 100644 index 00000000..285dd9a2 --- /dev/null +++ b/tests/std/strings/sprintf_variation4.phpt @@ -0,0 +1,24 @@ +--TEST-- +sprintf %u With signed integer 32bit +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(15) "%u = '43951789'" +string(17) "%u = '4251015507'" + diff --git a/tests/std/strings/sprintf_variation40.phpt b/tests/std/strings/sprintf_variation40.phpt new file mode 100644 index 00000000..3bec553d --- /dev/null +++ b/tests/std/strings/sprintf_variation40.phpt @@ -0,0 +1,254 @@ +--TEST-- +Test sprintf() function : usage variations - unsigned formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : unsigned formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(10) "4294967295" +string(10) "4294967295" +string(11) " 4294967295" +string(11) "4294967295 " +string(11) " 4294967295" +string(11) " +4294967295" +string(10) "4294967295" +string(30) " 4294967295" + +-- Iteration 4 -- +string(10) "2147483648" +string(10) "2147483648" +string(11) " 2147483648" +string(11) "2147483648 " +string(11) " 2147483648" +string(11) " +2147483648" +string(10) "2147483648" +string(30) " 2147483648" + +-- Iteration 5 -- +string(10) "2147483649" +string(10) "2147483649" +string(11) " 2147483649" +string(11) "2147483649 " +string(11) " 2147483649" +string(11) " +2147483649" +string(10) "2147483649" +string(30) " 2147483649" + +-- Iteration 6 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 7 -- +string(10) "2147483640" +string(10) "2147483640" +string(11) " 2147483640" +string(11) "2147483640 " +string(11) " 2147483640" +string(11) " +2147483640" +string(10) "2147483640" +string(30) " 2147483640" + +-- Iteration 8 -- +string(4) "4667" +string(4) "4667" +string(5) " 4667" +string(5) "4667 " +string(5) " 4667" +string(5) " +4667" +string(4) "4667" +string(30) " 4667" + +-- Iteration 9 -- +string(4) "4779" +string(4) "4779" +string(5) " 4779" +string(5) "4779 " +string(5) " 4779" +string(5) " +4779" +string(4) "4779" +string(30) " 4779" + +-- Iteration 10 -- +string(4) "4095" +string(4) "4095" +string(5) " 4095" +string(5) "4095 " +string(5) " 4095" +string(5) " +4095" +string(4) "4095" +string(30) " 4095" + +-- Iteration 11 -- +string(3) "250" +string(3) "250" +string(4) " 250" +string(4) "250 " +string(4) " 250" +string(4) " +250" +string(4) " 250" +string(30) " 250" + +-- Iteration 12 -- +string(10) "2147483648" +string(10) "2147483648" +string(11) " 2147483648" +string(11) "2147483648 " +string(11) " 2147483648" +string(11) " +2147483648" +string(10) "2147483648" +string(30) " 2147483648" + +-- Iteration 13 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 14 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 15 -- +string(2) "83" +string(2) "83" +string(3) " 83" +string(3) "83 " +string(3) " 83" +string(3) " +83" +string(4) " 83" +string(30) " 83" + +-- Iteration 16 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(10) "2147483648" +string(10) "2147483648" +string(11) " 2147483648" +string(11) "2147483648 " +string(11) " 2147483648" +string(11) " +2147483648" +string(10) "2147483648" +string(30) " 2147483648" + +-- Iteration 18 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" +Done diff --git a/tests/std/strings/sprintf_variation40_64bit.phpt b/tests/std/strings/sprintf_variation40_64bit.phpt new file mode 100644 index 00000000..da9b6949 --- /dev/null +++ b/tests/std/strings/sprintf_variation40_64bit.phpt @@ -0,0 +1,250 @@ +--TEST-- +Test sprintf() function : usage variations - unsigned formats with integer values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : unsigned formats with integer values *** + +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(2) " 0" +string(2) "0 " +string(2) " 0" +string(2) " +0" +string(4) " 0" +string(30) " 0" + +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 3 -- +string(20) "18446744073709551615" +string(20) "18446744073709551615" +string(21) " 18446744073709551615" +string(21) "18446744073709551615 " +string(21) " 18446744073709551615" +string(21) " +18446744073709551615" +string(20) "18446744073709551615" +string(30) " 18446744073709551615" + +-- Iteration 4 -- +string(20) "18446744071562067968" +string(20) "18446744071562067968" +string(21) " 18446744071562067968" +string(21) "18446744071562067968 " +string(21) " 18446744071562067968" +string(21) " +18446744071562067968" +string(20) "18446744071562067968" +string(30) " 18446744071562067968" + +-- Iteration 5 -- +string(20) "18446744071562067969" +string(20) "18446744071562067969" +string(21) " 18446744071562067969" +string(21) "18446744071562067969 " +string(21) " 18446744071562067969" +string(21) " +18446744071562067969" +string(20) "18446744071562067969" +string(30) " 18446744071562067969" + +-- Iteration 6 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 7 -- +string(10) "2147483640" +string(10) "2147483640" +string(11) " 2147483640" +string(11) "2147483640 " +string(11) " 2147483640" +string(11) " +2147483640" +string(10) "2147483640" +string(30) " 2147483640" + +-- Iteration 8 -- +string(4) "4667" +string(4) "4667" +string(5) " 4667" +string(5) "4667 " +string(5) " 4667" +string(5) " +4667" +string(4) "4667" +string(30) " 4667" + +-- Iteration 9 -- +string(4) "4779" +string(4) "4779" +string(5) " 4779" +string(5) "4779 " +string(5) " 4779" +string(5) " +4779" +string(4) "4779" +string(30) " 4779" + +-- Iteration 10 -- +string(4) "4095" +string(4) "4095" +string(5) " 4095" +string(5) "4095 " +string(5) " 4095" +string(5) " +4095" +string(4) "4095" +string(30) " 4095" + +-- Iteration 11 -- +string(3) "250" +string(3) "250" +string(4) " 250" +string(4) "250 " +string(4) " 250" +string(4) " +250" +string(4) " 250" +string(30) " 250" + +-- Iteration 12 -- +string(20) "18446744071562067968" +string(20) "18446744071562067968" +string(21) " 18446744071562067968" +string(21) "18446744071562067968 " +string(21) " 18446744071562067968" +string(21) " +18446744071562067968" +string(20) "18446744071562067968" +string(30) " 18446744071562067968" + +-- Iteration 13 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 14 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" + +-- Iteration 15 -- +string(2) "83" +string(2) "83" +string(3) " 83" +string(3) "83 " +string(3) " 83" +string(3) " +83" +string(4) " 83" +string(30) " 83" + +-- Iteration 16 -- +string(1) "1" +string(1) "1" +string(2) " 1" +string(2) "1 " +string(2) " 1" +string(2) " +1" +string(4) " 1" +string(30) " 1" + +-- Iteration 17 -- +string(20) "18446744071562067968" +string(20) "18446744071562067968" +string(21) " 18446744071562067968" +string(21) "18446744071562067968 " +string(21) " 18446744071562067968" +string(21) " +18446744071562067968" +string(20) "18446744071562067968" +string(30) " 18446744071562067968" + +-- Iteration 18 -- +string(10) "2147483647" +string(10) "2147483647" +string(11) " 2147483647" +string(11) "2147483647 " +string(11) " 2147483647" +string(11) " +2147483647" +string(10) "2147483647" +string(30) " 2147483647" +Done diff --git a/tests/std/strings/sprintf_variation46.phpt b/tests/std/strings/sprintf_variation46.phpt new file mode 100644 index 00000000..aafea5c5 --- /dev/null +++ b/tests/std/strings/sprintf_variation46.phpt @@ -0,0 +1,247 @@ +--TEST-- +Test sprintf() function : usage variations - scientific formats with integer values +--FILE-- + +--EXPECT-- +*** Testing sprintf() : scientific formats with integer values *** + +-- Iteration 1 -- +string(11) "0.000000e+0" +string(11) "0.000000e+0" +string(12) " 0.000000e+0" +string(12) "0.000000e+0 " +string(12) " 0.000000e+0" +string(12) " +0.000000e+0" +string(11) "0.000000e+0" +string(30) " 0.000000e+0" + +-- Iteration 2 -- +string(11) "1.000000e+0" +string(11) "1.000000e+0" +string(12) " 1.000000e+0" +string(12) "1.000000e+0 " +string(12) " 1.000000e+0" +string(12) " +1.000000e+0" +string(11) "1.000000e+0" +string(30) " 1.000000e+0" + +-- Iteration 3 -- +string(12) "-1.000000e+0" +string(12) "-1.000000e+0" +string(13) " -1.000000e+0" +string(13) "-1.000000e+0 " +string(13) " -1.000000e+0" +string(13) " +-1.000000e+0" +string(12) "-1.000000e+0" +string(30) " -1.000000e+0" + +-- Iteration 4 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 5 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 6 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 7 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 8 -- +string(11) "4.667000e+3" +string(11) "4.667000e+3" +string(12) " 4.667000e+3" +string(12) "4.667000e+3 " +string(12) " 4.667000e+3" +string(12) " +4.667000e+3" +string(11) "4.667000e+3" +string(30) " 4.667000e+3" + +-- Iteration 9 -- +string(11) "4.779000e+3" +string(11) "4.779000e+3" +string(12) " 4.779000e+3" +string(12) "4.779000e+3 " +string(12) " 4.779000e+3" +string(12) " +4.779000e+3" +string(11) "4.779000e+3" +string(30) " 4.779000e+3" + +-- Iteration 10 -- +string(11) "4.095000e+3" +string(11) "4.095000e+3" +string(12) " 4.095000e+3" +string(12) "4.095000e+3 " +string(12) " 4.095000e+3" +string(12) " +4.095000e+3" +string(11) "4.095000e+3" +string(30) " 4.095000e+3" + +-- Iteration 11 -- +string(11) "2.500000e+2" +string(11) "2.500000e+2" +string(12) " 2.500000e+2" +string(12) "2.500000e+2 " +string(12) " 2.500000e+2" +string(12) " +2.500000e+2" +string(11) "2.500000e+2" +string(30) " 2.500000e+2" + +-- Iteration 12 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 13 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 14 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 15 -- +string(11) "8.300000e+1" +string(11) "8.300000e+1" +string(12) " 8.300000e+1" +string(12) "8.300000e+1 " +string(12) " 8.300000e+1" +string(12) " +8.300000e+1" +string(11) "8.300000e+1" +string(30) " 8.300000e+1" + +-- Iteration 16 -- +string(11) "1.000000e+0" +string(11) "1.000000e+0" +string(12) " 1.000000e+0" +string(12) "1.000000e+0 " +string(12) " 1.000000e+0" +string(12) " +1.000000e+0" +string(11) "1.000000e+0" +string(30) " 1.000000e+0" + +-- Iteration 17 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 18 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" +Done diff --git a/tests/std/strings/sprintf_variation47.phpt b/tests/std/strings/sprintf_variation47.phpt new file mode 100644 index 00000000..8b29c9f5 --- /dev/null +++ b/tests/std/strings/sprintf_variation47.phpt @@ -0,0 +1,264 @@ +--TEST-- +Test sprintf() function : usage variations - scientific formats with float values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : scientific formats with float values *** + +-- Iteration 1 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 2 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 3 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 4 -- +string(12) "3.435974e+10" +string(12) "3.435974e+10" +string(13) " 3.435974e+10" +string(13) "3.435974e+10 " +string(13) " 3.435974e+10" +string(13) " +3.435974e+10" +string(12) "3.435974e+10" +string(30) " 3.435974e+10" + +-- Iteration 5 -- +string(11) "2.147484e+9" +string(11) "2.147484e+9" +string(12) " 2.147484e+9" +string(12) "2.147484e+9 " +string(12) " 2.147484e+9" +string(12) " +2.147484e+9" +string(11) "2.147484e+9" +string(30) " 2.147484e+9" + +-- Iteration 6 -- +string(12) "-2.147484e+9" +string(12) "-2.147484e+9" +string(13) " -2.147484e+9" +string(13) "-2.147484e+9 " +string(13) " -2.147484e+9" +string(13) " +-2.147484e+9" +string(12) "-2.147484e+9" +string(30) " -2.147484e+9" + +-- Iteration 7 -- +string(11) "0.000000e+0" +string(11) "0.000000e+0" +string(12) " 0.000000e+0" +string(12) "0.000000e+0 " +string(12) " 0.000000e+0" +string(12) " +0.000000e+0" +string(11) "0.000000e+0" +string(30) " 0.000000e+0" + +-- Iteration 8 -- +string(12) "-1.000000e-1" +string(12) "-1.000000e-1" +string(13) " -1.000000e-1" +string(13) "-1.000000e-1 " +string(13) " -1.000000e-1" +string(13) " +-1.000000e-1" +string(12) "-1.000000e-1" +string(30) " -1.000000e-1" + +-- Iteration 9 -- +string(11) "1.000000e+0" +string(11) "1.000000e+0" +string(12) " 1.000000e+0" +string(12) "1.000000e+0 " +string(12) " 1.000000e+0" +string(12) " +1.000000e+0" +string(11) "1.000000e+0" +string(30) " 1.000000e+0" + +-- Iteration 10 -- +string(11) "1.000000e+5" +string(11) "1.000000e+5" +string(12) " 1.000000e+5" +string(12) "1.000000e+5 " +string(12) " 1.000000e+5" +string(12) " +1.000000e+5" +string(11) "1.000000e+5" +string(30) " 1.000000e+5" + +-- Iteration 11 -- +string(12) "-1.000000e+5" +string(12) "-1.000000e+5" +string(13) " -1.000000e+5" +string(13) "-1.000000e+5 " +string(13) " -1.000000e+5" +string(13) " +-1.000000e+5" +string(12) "-1.000000e+5" +string(30) " -1.000000e+5" + +-- Iteration 12 -- +string(12) "-1.000000e+5" +string(12) "-1.000000e+5" +string(13) " -1.000000e+5" +string(13) "-1.000000e+5 " +string(13) " -1.000000e+5" +string(13) " +-1.000000e+5" +string(12) "-1.000000e+5" +string(30) " -1.000000e+5" + +-- Iteration 13 -- +string(11) "1.000000e+5" +string(11) "1.000000e+5" +string(12) " 1.000000e+5" +string(12) "1.000000e+5 " +string(12) " 1.000000e+5" +string(12) " +1.000000e+5" +string(11) "1.000000e+5" +string(30) " 1.000000e+5" + +-- Iteration 14 -- +string(11) "1.000000e+5" +string(11) "1.000000e+5" +string(12) " 1.000000e+5" +string(12) "1.000000e+5 " +string(12) " 1.000000e+5" +string(12) " +1.000000e+5" +string(11) "1.000000e+5" +string(30) " 1.000000e+5" + +-- Iteration 15 -- +string(12) "-1.000000e-5" +string(12) "-1.000000e-5" +string(13) " -1.000000e-5" +string(13) "-1.000000e-5 " +string(13) " -1.000000e-5" +string(13) " +-1.000000e-5" +string(12) "-1.000000e-5" +string(30) " -1.000000e-5" + +-- Iteration 16 -- +string(11) "1.000000e+8" +string(11) "1.000000e+8" +string(12) " 1.000000e+8" +string(12) "1.000000e+8 " +string(12) " 1.000000e+8" +string(12) " +1.000000e+8" +string(11) "1.000000e+8" +string(30) " 1.000000e+8" + +-- Iteration 17 -- +string(12) "-1.000000e+9" +string(12) "-1.000000e+9" +string(13) " -1.000000e+9" +string(13) "-1.000000e+9 " +string(13) " -1.000000e+9" +string(13) " +-1.000000e+9" +string(12) "-1.000000e+9" +string(30) " -1.000000e+9" + +-- Iteration 18 -- +string(11) "1.000000e+1" +string(11) "1.000000e+1" +string(12) " 1.000000e+1" +string(12) "1.000000e+1 " +string(12) " 1.000000e+1" +string(12) " +1.000000e+1" +string(11) "1.000000e+1" +string(30) " 1.000000e+1" + +-- Iteration 19 -- +string(11) "1.050000e+6" +string(11) "1.050000e+6" +string(12) " 1.050000e+6" +string(12) "1.050000e+6 " +string(12) " 1.050000e+6" +string(12) " +1.050000e+6" +string(11) "1.050000e+6" +string(30) " 1.050000e+6" +Done diff --git a/tests/std/strings/sprintf_variation4_64bit.phpt b/tests/std/strings/sprintf_variation4_64bit.phpt new file mode 100644 index 00000000..57d99316 --- /dev/null +++ b/tests/std/strings/sprintf_variation4_64bit.phpt @@ -0,0 +1,24 @@ +--TEST-- +sprintf %u With signed integer 32bit +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(15) "%u = '43951789'" +string(27) "%u = '18446744073665599827'" + diff --git a/tests/std/strings/sprintf_variation5.phpt b/tests/std/strings/sprintf_variation5.phpt new file mode 100644 index 00000000..5a862fe3 --- /dev/null +++ b/tests/std/strings/sprintf_variation5.phpt @@ -0,0 +1,37 @@ +--TEST-- +sprintf With signed integer +--FILE-- + +--EXPECT-- +string(33) "%b = '10100111101010011010101101'" +string(8) "%c = 'A'" +string(15) "%d = '43951789'" +string(18) "%e = '4.395179e+7'" +string(22) "%f = '43951789.000000'" +string(16) "%o = '247523255'" +string(15) "%s = '43951789'" +string(14) "%x = '29ea6ad'" +string(14) "%X = '29EA6AD'" +string(17) "%+d = '+43951789'" +string(17) "%+d = '-43951789'" diff --git a/tests/std/strings/sprintf_variation52.phpt b/tests/std/strings/sprintf_variation52.phpt new file mode 100644 index 00000000..d141bae7 --- /dev/null +++ b/tests/std/strings/sprintf_variation52.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test sprintf() function : usage variations - typical format strings +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +echo"\n-- Testing for '%X' as the format parameter --\n"; +var_dump(sprintf("%X", 12)); + +echo"\n-- Testing for multiple format parameters --\n"; +var_dump(sprintf("%d %s %d\n", $tempnum, $tempstring, $tempnum)); + +echo"\n-- Testing for excess of mixed type arguments --\n"; +var_dump(sprintf("%s", $tempstring, $tempstring, $tempstring)); + +echo "Done"; +?> +--EXPECTF-- +*** Testing sprintf() : with typical format strings *** + +-- Testing for '%%%.2f' as the format parameter -- +string(15) "%12345678900.00" + +-- Testing for '%%' as the format parameter -- +string(1) "%" + +-- Testing for precision value more than maximum -- + +Notice: sprintf(): Requested precision of 988 digits was truncated to PHP maximum of %d digits in %s on line %d +string(65) "12345678900.00000000000000000000000000000000000000000000000000000" + +-- Testing for invalid width(-15) specifier -- +Unknown format specifier "-" + +-- Testing for '%X' as the format parameter -- +string(1) "C" + +-- Testing for multiple format parameters -- +string(39) "12345 abcdefghjklmnpqrstuvwxyz 12345 +" + +-- Testing for excess of mixed type arguments -- +string(24) "abcdefghjklmnpqrstuvwxyz" +Done diff --git a/tests/std/strings/sprintf_variation53.phpt b/tests/std/strings/sprintf_variation53.phpt new file mode 100644 index 00000000..26f84a50 --- /dev/null +++ b/tests/std/strings/sprintf_variation53.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test sprintf() function : usage variations - with whitespaces in format strings +--FILE-- + +--EXPECT-- +*** Testing sprintf() : with white spaces in format strings *** +string(4) "1234" +string(4) "1234" +string(4) "1234" +string(11) "1234.000000" +string(11) "1234.000000" +string(11) "1234.000000" +string(11) "1234.000000" +string(11) "1234.000000" +string(11) "1234.000000" +string(11) "10011010010" +string(11) "10011010010" +string(11) "10011010010" +string(1) "Ò" +string(1) "Ò" +string(1) "Ò" +string(11) "1.234000e+3" +string(11) "1.234000e+3" +string(11) "1.234000e+3" +string(4) "1234" +string(4) "1234" +string(4) "1234" +string(4) "2322" +string(4) "2322" +string(4) "2322" +string(3) "4d2" +string(3) "4d2" +string(3) "4d2" +string(3) "4D2" +string(3) "4D2" +string(3) "4D2" +string(11) "1.234000E+3" +string(11) "1.234000E+3" +string(11) "1.234000E+3" +Done diff --git a/tests/std/strings/sprintf_variation54.phpt b/tests/std/strings/sprintf_variation54.phpt new file mode 100644 index 00000000..e925293c --- /dev/null +++ b/tests/std/strings/sprintf_variation54.phpt @@ -0,0 +1,215 @@ +--TEST-- +sprintf() formats with different types +--FILE-- +getMessage(), "\n"; + } + echo "\n"; + } +} + +?> +--EXPECTF-- +%s with null: + + +%s with false: + + +%s with true: +1 + +%s with 2: +2 + +s with 3.5: +3.5 + +%s with "foo": +foo + +%s with []: + +Warning: Array to string conversion in %s on line %d +Array + +%s with [1]: + +Warning: Array to string conversion in %s on line %d +Array + +%s with resource: +Resource id #%d + +%s with {}: +Object of class stdClass could not be converted to string + +d with null: +0 + +d with false: +0 + +d with true: +1 + +d with 2: +2 + +d with 3.5: +3 + +d with "foo": +0 + +d with []: +0 + +d with [1]: +1 + +d with resource: +%d + +d with {}: + +Warning: Object of class stdClass could not be converted to int in %s on line %d +1 + +u with null: +0 + +u with false: +0 + +u with true: +1 + +u with 2: +2 + +u with 3.5: +3 + +u with "foo": +0 + +u with []: +0 + +u with [1]: +1 + +u with resource: +%d + +u with {}: + +Warning: Object of class stdClass could not be converted to int in %s on line %d +1 + +f with null: +0.000000 + +f with false: +0.000000 + +f with true: +1.000000 + +f with 2: +2.000000 + +f with 3.5: +3.500000 + +f with "foo": +0.000000 + +f with []: +0.000000 + +f with [1]: +1.000000 + +f with resource: +%d.000000 + +f with {}: + +Warning: Object of class stdClass could not be converted to float in %s on line %d +1.000000 + +c with null: +%0 + +c with false: +%0 + +c with true: + + +c with 2: + + +c with 3.5: + + +c with "foo": +%0 + +c with []: +%0 + +c with [1]: + + +c with resource: +%s + +c with {}: + +Warning: Object of class stdClass could not be converted to int in %s on line %d + + +x with null: +0 + +x with false: +0 + +x with true: +1 + +x with 2: +2 + +x with 3.5: +3 + +x with "foo": +0 + +x with []: +0 + +x with [1]: +1 + +x with resource: +%d + +x with {}: + +Warning: Object of class stdClass could not be converted to int in %s on line %d +1 diff --git a/tests/std/strings/sprintf_variation9.phpt b/tests/std/strings/sprintf_variation9.phpt new file mode 100644 index 00000000..c367c438 --- /dev/null +++ b/tests/std/strings/sprintf_variation9.phpt @@ -0,0 +1,396 @@ +--TEST-- +Test sprintf() function : usage variations - float formats with float values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sprintf() : float formats with float values *** + +-- Iteration 1 -- +string(18) "-2147483649.000000" +string(18) "-2147483649.000000" +string(19) " -2147483649.000000" +string(19) "-2147483649.000000 " +string(19) " -2147483649.000000" +string(19) " +-2147483649.000000" +string(18) "-2147483649.000000" +string(30) " -2147483649.000000" + +-- Iteration 2 -- +string(17) "2147483648.000000" +string(17) "2147483648.000000" +string(18) " 2147483648.000000" +string(18) "2147483648.000000 " +string(18) " 2147483648.000000" +string(18) " +2147483648.000000" +string(17) "2147483648.000000" +string(30) " 2147483648.000000" + +-- Iteration 3 -- +string(18) "-2147483649.000000" +string(18) "-2147483649.000000" +string(19) " -2147483649.000000" +string(19) "-2147483649.000000 " +string(19) " -2147483649.000000" +string(19) " +-2147483649.000000" +string(18) "-2147483649.000000" +string(30) " -2147483649.000000" + +-- Iteration 4 -- +string(18) "34359738369.000000" +string(18) "34359738369.000000" +string(19) " 34359738369.000000" +string(19) "34359738369.000000 " +string(19) " 34359738369.000000" +string(19) " +34359738369.000000" +string(18) "34359738369.000000" +string(30) " 34359738369.000000" + +-- Iteration 5 -- +string(17) "2147483649.000000" +string(17) "2147483649.000000" +string(18) " 2147483649.000000" +string(18) "2147483649.000000 " +string(18) " 2147483649.000000" +string(18) " +2147483649.000000" +string(17) "2147483649.000000" +string(30) " 2147483649.000000" + +-- Iteration 6 -- +string(18) "-2147483649.000000" +string(18) "-2147483649.000000" +string(19) " -2147483649.000000" +string(19) "-2147483649.000000 " +string(19) " -2147483649.000000" +string(19) " +-2147483649.000000" +string(18) "-2147483649.000000" +string(30) " -2147483649.000000" + +-- Iteration 7 -- +string(8) "0.000000" +string(8) "0.000000" +string(9) " 0.000000" +string(9) "0.000000 " +string(9) " 0.000000" +string(9) " +0.000000" +string(8) "0.000000" +string(30) " 0.000000" + +-- Iteration 8 -- +string(9) "-0.100000" +string(9) "-0.100000" +string(10) " -0.100000" +string(10) "-0.100000 " +string(10) " -0.100000" +string(10) " +-0.100000" +string(9) "-0.100000" +string(30) " -0.100000" + +-- Iteration 9 -- +string(9) "10.000000" +string(9) "10.000000" +string(10) " 10.000000" +string(10) "10.000000 " +string(10) " 10.000000" +string(10) " +10.000000" +string(9) "10.000000" +string(30) " 10.000000" + +-- Iteration 10 -- +string(14) "1050000.000000" +string(14) "1050000.000000" +string(15) " 1050000.000000" +string(15) "1050000.000000 " +string(15) " 1050000.000000" +string(15) " +1050000.000000" +string(14) "1050000.000000" +string(30) " 1050000.000000" + +-- Iteration 11 -- +string(13) "100000.000000" +string(13) "100000.000000" +string(14) " 100000.000000" +string(14) "100000.000000 " +string(14) " 100000.000000" +string(14) " +100000.000000" +string(13) "100000.000000" +string(30) " 100000.000000" + +-- Iteration 12 -- +string(14) "-100000.000000" +string(14) "-100000.000000" +string(15) " -100000.000000" +string(15) "-100000.000000 " +string(15) " -100000.000000" +string(15) " +-100000.000000" +string(14) "-100000.000000" +string(30) " -100000.000000" + +-- Iteration 13 -- +string(8) "0.000010" +string(8) "0.000010" +string(9) " 0.000010" +string(9) "0.000010 " +string(9) " 0.000010" +string(9) " +0.000010" +string(8) "0.000010" +string(30) " 0.000010" + +-- Iteration 14 -- +string(9) "-0.000010" +string(9) "-0.000010" +string(10) " -0.000010" +string(10) "-0.000010 " +string(10) " -0.000010" +string(10) " +-0.000010" +string(9) "-0.000010" +string(30) " -0.000010" + +-- Iteration 15 -- +string(13) "100000.000000" +string(13) "100000.000000" +string(14) " 100000.000000" +string(14) "100000.000000 " +string(14) " 100000.000000" +string(14) " +100000.000000" +string(13) "100000.000000" +string(30) " 100000.000000" + +-- Iteration 16 -- +string(14) "-100000.000000" +string(14) "-100000.000000" +string(15) " -100000.000000" +string(15) "-100000.000000 " +string(15) " -100000.000000" +string(15) " +-100000.000000" +string(14) "-100000.000000" +string(30) " -100000.000000" + +-- Iteration 17 -- +string(13) "100000.000000" +string(13) "100000.000000" +string(14) " 100000.000000" +string(14) "100000.000000 " +string(14) " 100000.000000" +string(14) " +100000.000000" +string(13) "100000.000000" +string(30) " 100000.000000" + +-- Iteration 18 -- +string(14) "-100000.000000" +string(14) "-100000.000000" +string(15) " -100000.000000" +string(15) "-100000.000000 " +string(15) " -100000.000000" +string(15) " +-100000.000000" +string(14) "-100000.000000" +string(30) " -100000.000000" + +-- Iteration 19 -- +string(13) "100000.000000" +string(13) "100000.000000" +string(14) " 100000.000000" +string(14) "100000.000000 " +string(14) " 100000.000000" +string(14) " +100000.000000" +string(13) "100000.000000" +string(30) " 100000.000000" + +-- Iteration 20 -- +string(14) "-100000.000000" +string(14) "-100000.000000" +string(15) " -100000.000000" +string(15) "-100000.000000 " +string(15) " -100000.000000" +string(15) " +-100000.000000" +string(14) "-100000.000000" +string(30) " -100000.000000" + +-- Iteration 21 -- +string(8) "0.000010" +string(8) "0.000010" +string(9) " 0.000010" +string(9) "0.000010 " +string(9) " 0.000010" +string(9) " +0.000010" +string(8) "0.000010" +string(30) " 0.000010" + +-- Iteration 22 -- +string(9) "-0.000010" +string(9) "-0.000010" +string(10) " -0.000010" +string(10) "-0.000010 " +string(10) " -0.000010" +string(10) " +-0.000010" +string(9) "-0.000010" +string(30) " -0.000010" + +-- Iteration 23 -- +string(14) "5000000.000000" +string(14) "5000000.000000" +string(15) " 5000000.000000" +string(15) "5000000.000000 " +string(15) " 5000000.000000" +string(15) " +5000000.000000" +string(14) "5000000.000000" +string(30) " 5000000.000000" + +-- Iteration 24 -- +string(15) "-5000000.000000" +string(15) "-5000000.000000" +string(16) " -5000000.000000" +string(16) "-5000000.000000 " +string(16) " -5000000.000000" +string(16) " +-5000000.000000" +string(15) "-5000000.000000" +string(30) " -5000000.000000" + +-- Iteration 25 -- +string(8) "0.000000" +string(8) "0.000000" +string(9) " 0.000000" +string(9) "0.000000 " +string(9) " 0.000000" +string(9) " +0.000000" +string(8) "0.000000" +string(30) " 0.000000" + +-- Iteration 26 -- +string(9) "-0.000000" +string(9) "-0.000000" +string(10) " -0.000000" +string(10) "-0.000000 " +string(10) " -0.000000" +string(10) " +-0.000000" +string(9) "-0.000000" +string(30) " -0.000000" + +-- Iteration 27 -- +string(50) "5000000000000000069686058479707049565356032.000000" +string(50) "5000000000000000069686058479707049565356032.000000" +string(51) " 5000000000000000069686058479707049565356032.000000" +string(51) "5000000000000000069686058479707049565356032.000000 " +string(51) " 5000000000000000069686058479707049565356032.000000" +string(51) " +5000000000000000069686058479707049565356032.000000" +string(50) "5000000000000000069686058479707049565356032.000000" +string(50) "5000000000000000069686058479707049565356032.000000" + +-- Iteration 28 -- +string(51) "-5000000000000000069686058479707049565356032.000000" +string(51) "-5000000000000000069686058479707049565356032.000000" +string(52) " -5000000000000000069686058479707049565356032.000000" +string(52) "-5000000000000000069686058479707049565356032.000000 " +string(52) " -5000000000000000069686058479707049565356032.000000" +string(52) " +-5000000000000000069686058479707049565356032.000000" +string(51) "-5000000000000000069686058479707049565356032.000000" +string(51) "-5000000000000000069686058479707049565356032.000000" + +-- Iteration 29 -- +string(8) "0.000000" +string(8) "0.000000" +string(9) " 0.000000" +string(9) "0.000000 " +string(9) " 0.000000" +string(9) " +0.000000" +string(8) "0.000000" +string(30) " 0.000000" + +-- Iteration 30 -- +string(9) "-0.000000" +string(9) "-0.000000" +string(10) " -0.000000" +string(10) "-0.000000 " +string(10) " -0.000000" +string(10) " +-0.000000" +string(9) "-0.000000" +string(30) " -0.000000" +Done diff --git a/tests/std/strings/sscanf_basic1.phpt b/tests/std/strings/sscanf_basic1.phpt new file mode 100644 index 00000000..e2ba8ba1 --- /dev/null +++ b/tests/std/strings/sscanf_basic1.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test sscanf() function : basic functionality - string format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - using string format *** + +-- Try sccanf() WITHOUT optional args -- +string(6) "Widget" +string(7) "1234789" +string(2) "25" + +-- Try sccanf() WITH optional args -- +int(3) +string(6) "Widget" +string(7) "1234789" +string(2) "25" diff --git a/tests/std/strings/sscanf_basic2.phpt b/tests/std/strings/sscanf_basic2.phpt new file mode 100644 index 00000000..7c206c68 --- /dev/null +++ b/tests/std/strings/sscanf_basic2.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test sscanf() function : basic functionality - integer format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - using integer format *** + +-- Try sccanf() WITHOUT optional args -- +string(6) "Widget" +int(1234789) +int(25) + +-- Try sccanf() WITH optional args -- +int(3) +string(6) "Widget" +int(1234789) +int(25) diff --git a/tests/std/strings/sscanf_basic3.phpt b/tests/std/strings/sscanf_basic3.phpt new file mode 100644 index 00000000..f20ef73b --- /dev/null +++ b/tests/std/strings/sscanf_basic3.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test sscanf() function : basic functionality - float format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality -- using float format *** + +-- Try sccanf() WITHOUT optional args -- +string(6) "Widget" +float(111.53) +float(22.345) +float(12.4) + +-- Try sccanf() WITH optional args -- +int(4) +string(6) "Widget" +float(111.53) +float(22.345) +float(12.4) diff --git a/tests/std/strings/sscanf_basic4.phpt b/tests/std/strings/sscanf_basic4.phpt new file mode 100644 index 00000000..a4f06a6d --- /dev/null +++ b/tests/std/strings/sscanf_basic4.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test sscanf() function : basic functionality - char format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - using char format *** + +-- Try sccanf() WITHOUT optional args -- +string(1) "X" +string(1) "A" +string(1) "B" +string(1) "C" + +-- Try sccanf() WITH optional args -- +int(4) +string(1) "X" +string(1) "A" +string(1) "B" +string(1) "C" diff --git a/tests/std/strings/sscanf_basic5.phpt b/tests/std/strings/sscanf_basic5.phpt new file mode 100644 index 00000000..0738f8d6 --- /dev/null +++ b/tests/std/strings/sscanf_basic5.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test sscanf() function : basic functionality - exponential format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality -using exponential format *** + +-- Try sccanf() WITHOUT optional args -- +float(10.12345) +float(10123.45) +float(10123.45) +float(-101234.5) +float(10.12345) +float(10123.45) +float(10123.45) +float(-101234.5) + +-- Try sccanf() WITH optional args -- +int(4) +float(10.12345) +float(10123.45) +float(10123.45) +float(-101234.5) +int(4) +float(10.12345) +float(10123.45) +float(10123.45) +float(-101234.5) diff --git a/tests/std/strings/sscanf_basic6.phpt b/tests/std/strings/sscanf_basic6.phpt new file mode 100644 index 00000000..5aec9c09 --- /dev/null +++ b/tests/std/strings/sscanf_basic6.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test sscanf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - using unsigned format *** + +-- Try sccanf() WITHOUT optional args -- +string(10) "4294967285" +int(11) +int(11) +string(10) "4294967285" +NULL +NULL + +-- Try sccanf() WITH optional args -- +int(4) +string(10) "4294967285" +int(11) +int(11) +string(10) "4294967285" +NULL +NULL diff --git a/tests/std/strings/sscanf_basic7.phpt b/tests/std/strings/sscanf_basic7.phpt new file mode 100644 index 00000000..357fec55 --- /dev/null +++ b/tests/std/strings/sscanf_basic7.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test sscanf() function : basic functionality - octal format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - using octal format *** + +-- Try sccanf() WITHOUT optional args -- +int(83) +int(-83) +int(83) +int(10) +NULL +NULL + +-- Try sccanf() WITH optional args -- +int(4) +int(83) +int(-83) +int(83) +int(10) +NULL +NULL diff --git a/tests/std/strings/sscanf_basic8.phpt b/tests/std/strings/sscanf_basic8.phpt new file mode 100644 index 00000000..ecfc230a --- /dev/null +++ b/tests/std/strings/sscanf_basic8.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test sscanf() function : basic functionality - hexadecimal format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing sscanf() : basic functionality - - using hexadecimal format *** + +-- Try sccanf() WITHOUT optional args -- +int(297) +int(303) +int(4667) +int(-4667) +int(6844) +int(1) +int(297) +int(303) +int(4667) +int(-4667) +int(6844) +int(1) + +-- Try sccanf() WITH optional args -- +int(6) +int(297) +int(303) +int(4667) +int(-4667) +int(6844) +int(1) +int(6) +int(297) +int(303) +int(4667) +int(-4667) +int(6844) +int(1) diff --git a/tests/std/strings/sscanf_error.phpt b/tests/std/strings/sscanf_error.phpt new file mode 100644 index 00000000..8adc7a97 --- /dev/null +++ b/tests/std/strings/sscanf_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test sscanf() function : error conditions +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +?> +--EXPECT-- +*** Testing sscanf() : error conditions *** + +-- Testing sscanf() function with more than expected no. of arguments -- +Variable is not assigned by any conversion specifiers diff --git a/tests/std/strings/str_contains.phpt b/tests/std/strings/str_contains.phpt new file mode 100644 index 00000000..efca334f --- /dev/null +++ b/tests/std/strings/str_contains.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test str_contains() function +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) +bool(true) diff --git a/tests/std/strings/str_decrement_basic.phpt b/tests/std/strings/str_decrement_basic.phpt new file mode 100644 index 00000000..99663367 --- /dev/null +++ b/tests/std/strings/str_decrement_basic.phpt @@ -0,0 +1,82 @@ +--TEST-- +str_decrement(): Decrementing various strings +--FILE-- + +--EXPECT-- +string(2) "Ay" +string(2) "Az" +string(2) "aY" +string(2) "aZ" +string(2) "A8" +string(2) "A9" +string(2) "a8" +string(2) "a9" +string(2) "Yz" +string(2) "Za" +string(2) "yZ" +string(2) "zA" +string(2) "Y9" +string(2) "Z0" +string(2) "y9" +string(2) "z0" +string(1) "z" +string(2) "Aa" +string(1) "Z" +string(2) "aA" +string(1) "9" +string(2) "A0" +string(1) "9" +string(2) "a0" +string(1) "9" +string(2) "10" +string(1) "Z" +string(2) "1A" +string(1) "z" +string(2) "1a" +string(2) "9z" +string(3) "10a" +string(3) "5e5" +string(3) "5e6" +string(1) "c" +string(1) "d" +string(1) "C" +string(1) "D" +string(1) "3" +string(1) "4" +string(1) "0" +string(1) "1" diff --git a/tests/std/strings/str_decrement_errors.phpt b/tests/std/strings/str_decrement_errors.phpt new file mode 100644 index 00000000..3186d24b --- /dev/null +++ b/tests/std/strings/str_decrement_errors.phpt @@ -0,0 +1,53 @@ +--TEST-- +str_decrement(): Invalid strings to decrement should throw a ValueError +--FILE-- +getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +str_decrement(): Argument #1 ($string) must not be empty +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters diff --git a/tests/std/strings/str_decrement_underflow.phpt b/tests/std/strings/str_decrement_underflow.phpt new file mode 100644 index 00000000..05214977 --- /dev/null +++ b/tests/std/strings/str_decrement_underflow.phpt @@ -0,0 +1,32 @@ +--TEST-- +str_decrement(): Out of Range ValueErrors for strings that cannot be decremented +--FILE-- +getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +str_decrement(): Argument #1 ($string) must not be empty +str_decrement(): Argument #1 ($string) "0" is out of decrement range +str_decrement(): Argument #1 ($string) "a" is out of decrement range +str_decrement(): Argument #1 ($string) "A" is out of decrement range +str_decrement(): Argument #1 ($string) "00" is out of decrement range +str_decrement(): Argument #1 ($string) "0a" is out of decrement range +str_decrement(): Argument #1 ($string) "0A" is out of decrement range diff --git a/tests/std/strings/str_ends_with.phpt b/tests/std/strings/str_ends_with.phpt new file mode 100644 index 00000000..92e4fc65 --- /dev/null +++ b/tests/std/strings/str_ends_with.phpt @@ -0,0 +1,41 @@ +--TEST-- +str_ends_with() function - unit tests for str_ends_with() +--FILE-- + +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) diff --git a/tests/std/strings/str_getcsv_001.phpt b/tests/std/strings/str_getcsv_001.phpt new file mode 100644 index 00000000..d3e93cca --- /dev/null +++ b/tests/std/strings/str_getcsv_001.phpt @@ -0,0 +1,94 @@ +--TEST-- +str_getcsv(): Testing using various arguments +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + string(1) "f" + [1]=> + string(1) "o" + [2]=> + string(0) "" +} +----- +array(3) { + [0]=> + string(3) "foo" + [1]=> + string(0) "" + [2]=> + string(3) "bar" +} +----- +array(2) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" +} +----- +array(2) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" +} +----- +array(3) { + [0]=> + string(2) "f." + [1]=> + string(3) "bar" + [2]=> + string(4) "-|-." +} +----- +array(1) { + [0]=> + string(7) "foo.bar" +} +----- +array(2) { + [0]=> + string(5) "foo " + [1]=> + string(7) " bar " +} +----- +array(1) { + [0]=> + string(3) " " " +} +----- +array(1) { + [0]=> + NULL +} +----- diff --git a/tests/std/strings/str_getcsv_002.phpt b/tests/std/strings/str_getcsv_002.phpt new file mode 100644 index 00000000..de96e739 --- /dev/null +++ b/tests/std/strings/str_getcsv_002.phpt @@ -0,0 +1,17 @@ +--TEST-- +str_getcsv() with empty $escape +--FILE-- + +--EXPECT-- +Array +( + [0] => cell1 + [1] => cell2\ + [2] => cell3 + [3] => cell4 +) diff --git a/tests/std/strings/str_getcsv_errors.phpt b/tests/std/strings/str_getcsv_errors.phpt new file mode 100644 index 00000000..db6a2641 --- /dev/null +++ b/tests/std/strings/str_getcsv_errors.phpt @@ -0,0 +1,31 @@ +--TEST-- +str_getcsv(): Invalid arguments +--SKIPIF-- + +--FILE-- +getMessage(), PHP_EOL; +} +try { + var_dump(str_getcsv('csv_string', ',', 'enclosure', '')); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +try { + var_dump(str_getcsv('csv_string', ',', '"', 'escape')); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} + +?> +--EXPECT-- +ValueError: str_getcsv(): Argument #2 ($separator) must be a single character +ValueError: str_getcsv(): Argument #3 ($enclosure) must be a single character +ValueError: str_getcsv(): Argument #4 ($escape) must be empty or a single character diff --git a/tests/std/strings/str_increment_basic.phpt b/tests/std/strings/str_increment_basic.phpt new file mode 100644 index 00000000..1f238f6f --- /dev/null +++ b/tests/std/strings/str_increment_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +str_increment(): Incrementing various strings +--FILE-- + +--EXPECT-- +string(2) "Ba" +string(2) "Az" +string(2) "bA" +string(2) "aZ" +string(2) "B0" +string(2) "A9" +string(2) "b0" +string(2) "a9" +string(3) "AAa" +string(2) "Zz" +string(3) "aaA" +string(2) "zZ" +string(3) "10a" +string(2) "9z" +string(3) "10A" +string(2) "9Z" +string(3) "5e7" +string(3) "5e6" +string(1) "e" +string(1) "d" +string(1) "E" +string(1) "D" +string(1) "5" +string(1) "4" diff --git a/tests/std/strings/str_increment_errors.phpt b/tests/std/strings/str_increment_errors.phpt new file mode 100644 index 00000000..e06d7e4b --- /dev/null +++ b/tests/std/strings/str_increment_errors.phpt @@ -0,0 +1,53 @@ +--TEST-- +str_increment(): Invalid strings to increment should throw a ValueError +--FILE-- +getMessage(), PHP_EOL; + } +} + +?> +--EXPECT-- +str_increment(): Argument #1 ($string) must not be empty +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters +str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters diff --git a/tests/std/strings/str_increment_polyfill.phpt b/tests/std/strings/str_increment_polyfill.phpt new file mode 100644 index 00000000..e4818bb4 --- /dev/null +++ b/tests/std/strings/str_increment_polyfill.phpt @@ -0,0 +1,63 @@ +--TEST-- +Verifying that the str_increment() polyfill behaves the same +--SKIPIF-- + +--FILE-- + 'e', + 'F' => 'E', + 'g' => 'f', + 'G' => 'F', + }; + return $s; + } + } + return @++$s; +} + +$strictlyAlphaNumeric = [ + "Az", + "aZ", + "A9", + "a9", + // Carrying values until the beginning of the string + "Zz", + "zZ", + "9z", + "9Z", + // string interpretable as a number in scientific notation + "5e6", + "5E6", + "5e9", + "5E9", + // Interned strings + "d", + "D", + "4", +]; + +foreach ($strictlyAlphaNumeric as $s) { + if (str_increment($s) !== polyfill($s)) { + var_dump("Error:", str_increment($s), polyfill($s)); + } +} + +echo "DONE"; + +?> +--EXPECT-- +DONE diff --git a/tests/std/strings/str_ireplace.phpt b/tests/std/strings/str_ireplace.phpt new file mode 100644 index 00000000..c360004a --- /dev/null +++ b/tests/std/strings/str_ireplace.phpt @@ -0,0 +1,90 @@ +--TEST-- +str_ireplace() tests +--FILE-- +"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY"))); +var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"), array("key"=>"ttttTttttttttTT", "test"=>"aayyaayasdayYahsdYYY"))); + +/* separate testcase for str_ireplace() off-by-one */ + +$Data = "Change tracking and management software designed to watch + for abnormal system behavior.\nSuggest features, report bugs, or ask + questions here."; +var_dump($Data = str_ireplace("\r\n", "
", $Data)); +var_dump($Data = str_ireplace("\n", "
", $Data)); + + +echo "Done\n"; +?> +--EXPECT-- +string(0) "" +string(8) "aaaaaaaT" +string(8) "aaaaaaaT" +int(7) +string(15) "aaaaaaaaaaaaaaT" +string(15) "aaaaaaaaaaaaaaT" +int(7) +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +int(7) +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +int(7) +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +string(22) "aaaaaaaaaaaaaaaaaaaaaT" +array(2) { + [0]=> + string(22) "aaaaaaaaaaaaaaaaaaaaaT" + [1]=> + string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb" +} +array(2) { + ["key"]=> + string(22) "aaaaaaaaaaaaaaaaaaaaaT" + ["test"]=> + string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb" +} +array(2) { + ["key"]=> + string(22) "aaaaaaaaaaaaaaaaaaaaaT" + ["test"]=> + string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb" +} +string(149) "Change tracking and management software designed to watch + for abnormal system behavior. +Suggest features, report bugs, or ask + questions here." +string(158) "Change tracking and management software designed to watch
for abnormal system behavior.
Suggest features, report bugs, or ask
questions here." +Done diff --git a/tests/std/strings/str_pad.phpt b/tests/std/strings/str_pad.phpt new file mode 100644 index 00000000..834ed165 --- /dev/null +++ b/tests/std/strings/str_pad.phpt @@ -0,0 +1,310 @@ +--TEST-- +str_pad() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + sizeof(input_string) + 16, // pad_length > sizeof(input_string) +); + +$pad_string = "="; +/* loop through to use each variant of $pad_length on each element of $input_strings array */ +foreach ($input_strings as $input_string ) { + foreach ($pad_lengths as $pad_length ) { + var_dump( str_pad($input_string, $pad_length) ); // default pad_string & pad_type + var_dump( str_pad($input_string, $pad_length, $pad_string) ); // default pad_type + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_LEFT) ); + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_RIGHT) ); + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_BOTH) ); + } +} + +echo "\n#### variation with pad string ####\n"; +$pad_strings = array ("=", 1, true, "string_pad", 1.5, "\t", '\t'); +$input_string="variation"; +$pad_length = 16; +foreach ( $pad_strings as $pad_string ) { + var_dump( str_pad($input_string, $pad_length, $pad_string) ); // default pad_type + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_LEFT) ); + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_RIGHT) ); + var_dump( str_pad($input_string, $pad_length, $pad_string, STR_PAD_BOTH) ); +} + +echo "\n#### error conditions ####\n"; + +echo "\n--- empty padding string ---\n"; + +try { + str_pad($input_string, 12, ""); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +/* bad pad_type - passing an undefined one */ + +try { + str_pad($input_string, $pad_length, "+", 15); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +?> +--EXPECT-- +#### Basic operations #### +string(20) "str_pad() " +string(20) "str_pad()-+-+-+-+-+-" +string(20) "-+-+-+-+-+-str_pad()" +string(20) "str_pad()-+-+-+-+-+-" +string(20) "-+-+-str_pad()-+-+-+" + +#### variations with input string and pad-length #### +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(9) "variation" +string(10) "variation " +string(10) "variation=" +string(10) "=variation" +string(10) "variation=" +string(10) "variation=" +string(16) "variation " +string(16) "variation=======" +string(16) "=======variation" +string(16) "variation=======" +string(16) "===variation====" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(9) " " +string(9) "=========" +string(9) "=========" +string(9) "=========" +string(9) "=========" +string(10) " " +string(10) "==========" +string(10) "==========" +string(10) "==========" +string(10) "==========" +string(16) " " +string(16) "================" +string(16) "================" +string(16) "================" +string(16) "================" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(9) "1 " +string(9) "1========" +string(9) "========1" +string(9) "1========" +string(9) "====1====" +string(10) "1 " +string(10) "1=========" +string(10) "=========1" +string(10) "1=========" +string(10) "====1=====" +string(16) "1 " +string(16) "1===============" +string(16) "===============1" +string(16) "1===============" +string(16) "=======1========" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(9) "15 " +string(9) "15=======" +string(9) "=======15" +string(9) "15=======" +string(9) "===15====" +string(10) "15 " +string(10) "15========" +string(10) "========15" +string(10) "15========" +string(10) "====15====" +string(16) "15 " +string(16) "15==============" +string(16) "==============15" +string(16) "15==============" +string(16) "=======15=======" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(5) "15.55" +string(9) "15.55 " +string(9) "15.55====" +string(9) "====15.55" +string(9) "15.55====" +string(9) "==15.55==" +string(10) "15.55 " +string(10) "15.55=====" +string(10) "=====15.55" +string(10) "15.55=====" +string(10) "==15.55===" +string(16) "15.55 " +string(16) "15.55===========" +string(16) "===========15.55" +string(16) "15.55===========" +string(16) "=====15.55======" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(4) "2990" +string(9) "2990 " +string(9) "2990=====" +string(9) "=====2990" +string(9) "2990=====" +string(9) "==2990===" +string(10) "2990 " +string(10) "2990======" +string(10) "======2990" +string(10) "2990======" +string(10) "===2990===" +string(16) "2990 " +string(16) "2990============" +string(16) "============2990" +string(16) "2990============" +string(16) "======2990======" + +#### variation with pad string #### +string(16) "variation=======" +string(16) "=======variation" +string(16) "variation=======" +string(16) "===variation====" +string(16) "variation1111111" +string(16) "1111111variation" +string(16) "variation1111111" +string(16) "111variation1111" +string(16) "variation1111111" +string(16) "1111111variation" +string(16) "variation1111111" +string(16) "111variation1111" +string(16) "variationstring_" +string(16) "string_variation" +string(16) "variationstring_" +string(16) "strvariationstri" +string(16) "variation1.51.51" +string(16) "1.51.51variation" +string(16) "variation1.51.51" +string(16) "1.5variation1.51" +string(16) "variation " +string(16) " variation" +string(16) "variation " +string(16) " variation " +string(16) "variation\t\t\t\" +string(16) "\t\t\t\variation" +string(16) "variation\t\t\t\" +string(16) "\t\variation\t\t" + +#### error conditions #### + +--- empty padding string --- +str_pad(): Argument #3 ($pad_string) must not be empty +str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH diff --git a/tests/std/strings/str_pad_variation1.phpt b/tests/std/strings/str_pad_variation1.phpt new file mode 100644 index 00000000..cb71e611 --- /dev/null +++ b/tests/std/strings/str_pad_variation1.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test str_pad() function : usage variations - large values for '$pad_length' argument +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} + +$php_int_max_pad_length = PHP_INT_MAX; +var_dump( str_pad($input, $php_int_max_pad_length) ); + + +?> +--EXPECTF-- +*** Testing str_pad() function: with large value for for 'pad_length' argument *** +str_pad(): Argument #2 ($length) must be of type int, float given + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/tests/std/strings/str_pad_variation2.phpt b/tests/std/strings/str_pad_variation2.phpt new file mode 100644 index 00000000..802903b3 --- /dev/null +++ b/tests/std/strings/str_pad_variation2.phpt @@ -0,0 +1,75 @@ +--TEST-- +str_pad() function: usage variations - Non printable chars +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + sizeof(input_string) + 16, // pad_length > sizeof(input_string) +]; + +$pad_string = "="; + +/*loop through to use each variant of $pad_length on + each element of $input_strings array */ +foreach ($pad_lengths as $pad_length ) { + // default pad_string & pad_type + var_dump( bin2hex( str_pad($string, $pad_length) ) ); + // default pad_type + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_LEFT) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_RIGHT) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_BOTH) ) ); +} + +?> + +DONE +?> +--EXPECT-- +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(18) "00ff80ea8f20202020" +string(18) "00ff80ea8f3d3d3d3d" +string(18) "3d3d3d3d00ff80ea8f" +string(18) "00ff80ea8f3d3d3d3d" +string(18) "3d3d00ff80ea8f3d3d" +string(20) "00ff80ea8f2020202020" +string(20) "00ff80ea8f3d3d3d3d3d" +string(20) "3d3d3d3d3d00ff80ea8f" +string(20) "00ff80ea8f3d3d3d3d3d" +string(20) "3d3d00ff80ea8f3d3d3d" +string(32) "00ff80ea8f2020202020202020202020" +string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d" +string(32) "3d3d3d3d3d3d3d3d3d3d3d00ff80ea8f" +string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d" +string(32) "3d3d3d3d3d00ff80ea8f3d3d3d3d3d3d" + +DONE diff --git a/tests/std/strings/str_pad_variation5.phpt b/tests/std/strings/str_pad_variation5.phpt new file mode 100644 index 00000000..1a65366c --- /dev/null +++ b/tests/std/strings/str_pad_variation5.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test str_pad() function : usage variations - unexpected large value for '$pad_length' argument +--INI-- +memory_limit=128M +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing str_pad() function: with large value for for 'pad_length' argument *** + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/tests/std/strings/str_repeat.phpt b/tests/std/strings/str_repeat.phpt new file mode 100644 index 00000000..3351e7f8 --- /dev/null +++ b/tests/std/strings/str_repeat.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test str_repeat() function +--INI-- +precision=14 +--FILE-- + "; + echo str_repeat($input, $n)."\n"; + } +} + +echo "\n\n*** Testing error conditions ***\n"; +try { + str_repeat($input[0], -1); // Invalid arg for multiplier +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +?> + +--EXPECTF-- +*** Testing str_repeat() with possible strings *** +--- str_repeat() of 'a' --- +-- after repeating 0 times is => +-- after repeating 1 times is => a +-- after repeating 2 times is => aa +-- after repeating 3 times is => aaa + +--- str_repeat() of 'foo' --- +-- after repeating 0 times is => +-- after repeating 1 times is => foo +-- after repeating 2 times is => foofoo +-- after repeating 3 times is => foofoofoo + +--- str_repeat() of 'barbazbax' --- +-- after repeating 0 times is => +-- after repeating 1 times is => barbazbax +-- after repeating 2 times is => barbazbaxbarbazbax +-- after repeating 3 times is => barbazbaxbarbazbaxbarbazbax + +--- str_repeat() of '%0' --- +-- after repeating 0 times is => +-- after repeating 1 times is => %0 +-- after repeating 2 times is => %0%0 +-- after repeating 3 times is => %0%0%0 + +--- str_repeat() of '\0' --- +-- after repeating 0 times is => +-- after repeating 1 times is => \0 +-- after repeating 2 times is => \0\0 +-- after repeating 3 times is => \0\0\0 + +--- str_repeat() of '1' --- +-- after repeating 0 times is => +-- after repeating 1 times is => 1 +-- after repeating 2 times is => 11 +-- after repeating 3 times is => 111 + +--- str_repeat() of '4' --- +-- after repeating 0 times is => +-- after repeating 1 times is => 4 +-- after repeating 2 times is => 44 +-- after repeating 3 times is => 444 + +--- str_repeat() of '1.23' --- +-- after repeating 0 times is => +-- after repeating 1 times is => 1.23 +-- after repeating 2 times is => 1.231.23 +-- after repeating 3 times is => 1.231.231.23 + +--- str_repeat() of '' --- +-- after repeating 0 times is => +-- after repeating 1 times is => +-- after repeating 2 times is => +-- after repeating 3 times is => + +--- str_repeat() of ' ' --- +-- after repeating 0 times is => +-- after repeating 1 times is => +-- after repeating 2 times is => +-- after repeating 3 times is => + + +*** Testing error conditions *** +str_repeat(): Argument #2 ($times) must be greater than or equal to 0 diff --git a/tests/std/strings/str_repeat_variation1.phpt b/tests/std/strings/str_repeat_variation1.phpt new file mode 100644 index 00000000..e9a6407d --- /dev/null +++ b/tests/std/strings/str_repeat_variation1.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test str_repeat() function: usage variations - complex strings containing other than 7-bit chars +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +DONE +?> +--EXPECT-- +bool(true) +string(42) "008081eaebfeff008081eaebfeff008081eaebfeff" +string(42) "008081eaebfeff008081eaebfeff008081eaebfeff" +DONE diff --git a/tests/std/strings/str_replace_array_refs.phpt b/tests/std/strings/str_replace_array_refs.phpt new file mode 100644 index 00000000..281bb942 --- /dev/null +++ b/tests/std/strings/str_replace_array_refs.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test str_replace() function and array refs +--INI-- +precision=14 +--FILE-- + 'b', 'numeric' => 1]; +$ref = &$data; +$b = &$ref['a']; +$numeric = &$ref['numeric']; +var_dump(str_replace(array_keys($data), $data, "a numeric")); +var_dump($numeric); +var_dump($data['numeric']); +?> +--EXPECT-- +string(3) "b 1" +int(1) +int(1) diff --git a/tests/std/strings/str_replace_array_refs2.phpt b/tests/std/strings/str_replace_array_refs2.phpt new file mode 100644 index 00000000..bbc31c27 --- /dev/null +++ b/tests/std/strings/str_replace_array_refs2.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test str_replace() function and array refs, more cases +--SKIPIF-- + +--FILE-- +prop = ['x' => 'property']; +$obj->prop = $closure($obj->prop, ['x'], 'a'); +var_dump(str_replace(array_keys($obj->prop), $obj->prop, "x property")); + +$array = ['x' => 'property']; +$array = $closure($array, ['x'], 'a'); +var_dump(str_replace(array_keys($array), $array, "x property")); +?> +--EXPECT-- +string(10) "a property" +string(10) "a property" diff --git a/tests/std/strings/str_replace_basic.phpt b/tests/std/strings/str_replace_basic.phpt new file mode 100644 index 00000000..4dfbd098 --- /dev/null +++ b/tests/std/strings/str_replace_basic.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test str_replace() function basic function +--INI-- +precision=14 +--FILE-- +getMessage(), "\n"; +} +var_dump( $fp_copy ); +fclose($fp); + +?> +--EXPECTF-- +*** Testing str_replace() on basic operations *** +string(0) "" +string(4) "tbst" +string(0) "" +int(0) +string(1) "q" +int(1) +string(0) "" +int(0) +str_replace(): Argument #1 ($search) must be of type array|string, resource given +resource(%d) of type (stream) diff --git a/tests/std/strings/str_replace_variation1.phpt b/tests/std/strings/str_replace_variation1.phpt new file mode 100644 index 00000000..558654c9 --- /dev/null +++ b/tests/std/strings/str_replace_variation1.phpt @@ -0,0 +1,400 @@ +--TEST-- +Test str_replace() function - test search values +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +*** Testing str_replace() with various search values *** +-- Iteration 0 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(5) "FOUND" + [1]=> + string(0) "" + [2]=> + string(5) "FOUND" + [3]=> + string(1) "0" + [4]=> + string(6) "-FOUND" + [5]=> + string(5) "FOUND" + [6]=> + string(1) "0" + [7]=> + string(6) "-FOUND" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(5) + +-- Iteration 1 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(0) + +-- Iteration 2 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(5) "FOUND" + [1]=> + string(0) "" + [2]=> + string(5) "FOUND" + [3]=> + string(1) "0" + [4]=> + string(6) "-FOUND" + [5]=> + string(5) "FOUND" + [6]=> + string(1) "0" + [7]=> + string(6) "-FOUND" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(5) + +-- Iteration 3 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(5) "FOUND" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(5) "FOUND" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(2) + +-- Iteration 4 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(5) "FOUND" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(5) "FOUND" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(2) + +-- Iteration 5 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(5) "FOUND" + [1]=> + string(0) "" + [2]=> + string(5) "FOUND" + [3]=> + string(1) "0" + [4]=> + string(6) "-FOUND" + [5]=> + string(5) "FOUND" + [6]=> + string(1) "0" + [7]=> + string(6) "-FOUND" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(5) + +-- Iteration 6 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(5) "FOUND" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(5) "FOUND" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(2) + +-- Iteration 7 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(5) "FOUND" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(5) "FOUND" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(2) + +-- Iteration 8 -- + +Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in %s on line %d + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(0) + +-- Iteration 9 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(0) + +-- Iteration 10 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(5) "FOUND" + [11]=> + string(0) "" +} +int(1) + +-- Iteration 11 -- + +Warning: Array to string conversion in %s on line %d +array(12) { + [0]=> + string(1) "1" + [1]=> + string(0) "" + [2]=> + string(1) "1" + [3]=> + string(1) "0" + [4]=> + string(2) "-1" + [5]=> + string(1) "1" + [6]=> + string(1) "0" + [7]=> + string(2) "-1" + [8]=> + string(0) "" + [9]=> + string(5) "Array" + [10]=> + string(3) "php" + [11]=> + string(0) "" +} +int(0) diff --git a/tests/std/strings/str_replace_variation2.phpt b/tests/std/strings/str_replace_variation2.phpt new file mode 100644 index 00000000..d8dcd58e --- /dev/null +++ b/tests/std/strings/str_replace_variation2.phpt @@ -0,0 +1,300 @@ +--TEST-- +Test str_replace() function +--INI-- +precision=14 +--FILE-- + --\n"; + var_dump( str_replace($search_str[$i], "FOUND", $subject, $count) ); + echo "-- search string has found '$count' times\n"; +} + +?> +--EXPECTF-- +*** Testing str_replace() with various subjects *** +--- Iteration 0 --- +-- String after replacing the search value is => -- +string(179) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!FOUND + ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '2' times + +--- Iteration 1 --- +-- String after replacing the search value is => -- +string(179) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!FOUND + ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '2' times + +--- Iteration 2 --- +-- String after replacing the search value is => -- +string(184) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: FOUND + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 3 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 4 --- +-- String after replacing the search value is => -- +string(184) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $FOUND: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 5 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 6 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 7 --- +-- String after replacing the search value is => -- +string(191) "Hello, world,0120333.3445FOUND67 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 8 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 9 --- +-- String after replacing the search value is => -- +string(195) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0FOUND \xXYZ FOUND $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '2' times + +--- Iteration 10 --- +-- String after replacing the search value is => -- +string(195) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xFOUND abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 11 --- +-- String after replacing the search value is => -- +string(194) "Hello, world,0120333.3445-1.234567 FOUND TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 12 --- +-- String after replacing the search value is => -- +string(213) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE%0 + %0FOUNDZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(FOUND)" +-- search string has found '5' times + +--- Iteration 13 --- +-- String after replacing the search value is => -- +string(213) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE%0 + %0FOUNDZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(FOUND)" +-- search string has found '5' times + +--- Iteration 14 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 15 --- +-- String after replacing the search value is => -- +string(333) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0 +FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND%00ZCD%0abcdFOUND\xXYZ abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorld +FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '35' times + +--- Iteration 16 --- +-- String after replacing the search value is => -- +string(205) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSEFOUND + FOUND0ZCDFOUNDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '3' times + +--- Iteration 17 --- +-- String after replacing the search value is => -- +string(196) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + FOUNDZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 18 --- +-- String after replacing the search value is => -- +string(196) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00FOUNDD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 19 --- +-- String after replacing the search value is => -- +string(196) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + FOUNDZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 20 --- +-- String after replacing the search value is => -- +string(196) "Hello, world,0120333FOUND445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 21 --- +-- String after replacing the search value is => -- +string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '3' times + +--- Iteration 22 --- +-- String after replacing the search value is => -- +string(194) "Hello, world,0120333.3445-1.234567 NULL FOUND FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 23 --- +-- String after replacing the search value is => -- +string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '3' times + +--- Iteration 24 --- +-- String after replacing the search value is => -- +string(205) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '3' times + +--- Iteration 25 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 26 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FOUND%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 27 --- +-- String after replacing the search value is => -- +string(333) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE%0 +FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND%00ZCD%0abcdFOUND\xXYZ abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorld +FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '35' times + +--- Iteration 28 --- +-- String after replacing the search value is => -- +string(188) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 29 --- +-- String after replacing the search value is => -- +string(201) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0aFOUNDcd \xXYZ aFOUNDcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '2' times + +--- Iteration 30 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 31 --- +-- String after replacing the search value is => -- +string(197) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZFOUNDabcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '1' times + +--- Iteration 32 --- +-- String after replacing the search value is => -- +string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE%0 + %00ZCD%0abcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World + ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(0)" +-- search string has found '0' times + +--- Iteration 33 --- +-- String after replacing the search value is => -- +string(5) "FOUND" +-- search string has found '1' times diff --git a/tests/std/strings/str_replace_variation3.phpt b/tests/std/strings/str_replace_variation3.phpt new file mode 100644 index 00000000..da4934af --- /dev/null +++ b/tests/std/strings/str_replace_variation3.phpt @@ -0,0 +1,230 @@ +--TEST-- +Test str_replace() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- +getMessage() . "\n"; +} + +var_dump(str_replace("a", 1, array("aaa", "bbb"), $count)); +var_dump($count); + +var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count)); +var_dump($count); + + +echo "\n-- Testing Resources --\n"; +$resource1 = fopen( __FILE__, "r" ); +$resource2 = opendir( "." ); +try { + var_dump(str_replace("stream", "FOUND", $resource1, $count)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(str_replace("stream", "FOUND", $resource2, $count)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + + +echo "\n-- Testing a longer and heredoc string --\n"; +$string = << +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d + +*** Testing Miscellaneous input data *** +string(3) "qqq" +int(5) +array(3) { + [0]=> + string(3) "qqq" + [1]=> + string(0) "" + [2]=> + string(3) "ccc" +} +int(6) + +-- Testing objects -- +string(12) "Hello, world" +int(1) + +-- Testing arrays -- +string(15) "multimultimulti" +int(3) +string(3) "qqq" +int(3) +array(2) { + [0]=> + string(3) "qqq" + [1]=> + string(3) "ccc" +} +int(6) +str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string +array(2) { + [0]=> + string(3) "111" + [1]=> + string(3) "bbb" +} +int(3) +array(2) { + [0]=> + string(4) "aaa3" + [1]=> + string(4) "2bbb" +} +int(1) + +-- Testing Resources -- +str_replace(): Argument #3 ($subject) must be of type array|string, resource given +str_replace(): Argument #3 ($subject) must be of type array|string, resource given + +-- Testing a longer and heredoc string -- +string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789 +@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&* +FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789" +int(16) + +-- Testing a heredoc null string -- +string(0) "" +int(0) + +-- Testing simple and complex syntax strings -- +string(5) "FOUND" +string(5) "FOUND" + +Warning: Undefined variable $strS in %s on line %d +string(0) "" +string(5) "FOUND" +string(5) "FOUND" diff --git a/tests/std/strings/str_rot13_basic.phpt b/tests/std/strings/str_rot13_basic.phpt new file mode 100644 index 00000000..5a71a937 --- /dev/null +++ b/tests/std/strings/str_rot13_basic.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test soundex() function : basic functionality +--FILE-- +.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} + +echo "\nEnsure strings round trip\n"; +$str = "str_rot13() tests starting"; +$encode = str_rot13($str); +$decode = str_rot13($encode); +if (strcmp($str, $decode) == 0) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} +?> +--EXPECT-- +*** Testing str_rot13() : basic functionality *** + +Basic tests +string(26) "fge_ebg13() grfgf fgnegvat" +string(26) "nopqrstuvwxyzabcdefghijklm" + +Ensure numeric characters are left untouched +Strings equal : TEST PASSED + +Ensure non-alphabetic characters are left untouched +Strings unequal : TEST FAILED + +Ensure strings round trip +Strings equal : TEST PASSED diff --git a/tests/std/strings/str_shuffle.phpt b/tests/std/strings/str_shuffle.phpt new file mode 100644 index 00000000..f5122bc2 --- /dev/null +++ b/tests/std/strings/str_shuffle.phpt @@ -0,0 +1,11 @@ +--TEST-- +Testing str_shuffle. +--FILE-- + +--EXPECTF-- +string(3) %s +string(3) "123" diff --git a/tests/std/strings/str_shuffle_basic.phpt b/tests/std/strings/str_shuffle_basic.phpt new file mode 100644 index 00000000..d077b305 --- /dev/null +++ b/tests/std/strings/str_shuffle_basic.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test str_shuffle() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing str_shuffle() : basic functionality *** +string(47) "%s" +TEST PASSED diff --git a/tests/std/strings/str_split_basic.phpt b/tests/std/strings/str_split_basic.phpt new file mode 100644 index 00000000..86bf2884 --- /dev/null +++ b/tests/std/strings/str_split_basic.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test str_split() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing str_split() : basic functionality *** +-- With all possible arguments -- +array(5) { + [0]=> + string(5) "This " + [1]=> + string(5) "is ba" + [2]=> + string(5) "sic t" + [3]=> + string(5) "estca" + [4]=> + string(2) "se" +} +-- With split_length as default argument -- +array(22) { + [0]=> + string(1) "T" + [1]=> + string(1) "h" + [2]=> + string(1) "i" + [3]=> + string(1) "s" + [4]=> + string(1) " " + [5]=> + string(1) "i" + [6]=> + string(1) "s" + [7]=> + string(1) " " + [8]=> + string(1) "b" + [9]=> + string(1) "a" + [10]=> + string(1) "s" + [11]=> + string(1) "i" + [12]=> + string(1) "c" + [13]=> + string(1) " " + [14]=> + string(1) "t" + [15]=> + string(1) "e" + [16]=> + string(1) "s" + [17]=> + string(1) "t" + [18]=> + string(1) "c" + [19]=> + string(1) "a" + [20]=> + string(1) "s" + [21]=> + string(1) "e" +} +-- Empty string must always return empty array -- +array(0) { +} +array(0) { +} +array(0) { +} diff --git a/tests/std/strings/str_split_variation3.phpt b/tests/std/strings/str_split_variation3.phpt new file mode 100644 index 00000000..d7f5434f --- /dev/null +++ b/tests/std/strings/str_split_variation3.phpt @@ -0,0 +1,156 @@ +--TEST-- +Test str_split() function : usage variations - different double quoted strings for 'str' argument +--FILE-- + +--EXPECTF-- +*** Testing str_split() : double quoted strings for 'str' *** +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) " " +} +-- Iteration 3 -- +array(1) { + [0]=> + string(4) "1234" +} +-- Iteration 4 -- +array(2) { + [0]=> + string(7) "simple " + [1]=> + string(6) "string" +} +-- Iteration 5 -- +array(4) { + [0]=> + string(7) "It's st" + [1]=> + string(7) "ring wi" + [2]=> + string(7) "th quot" + [3]=> + string(1) "e" +} +-- Iteration 6 -- +array(5) { + [0]=> + string(7) "string " + [1]=> + string(7) "contain" + [2]=> + string(7) "s white" + [3]=> + string(7) " space +" + [4]=> + string(5) "chars" +} +-- Iteration 7 -- +array(4) { + [0]=> + string(7) "contain" + [1]=> + string(7) "ing @ #" + [2]=> + string(7) " $ % ^ " + [3]=> + string(7) "& chars" +} +-- Iteration 8 -- +array(3) { + [0]=> + string(7) "with 12" + [1]=> + string(7) "34 numb" + [2]=> + string(3) "ers" +} +-- Iteration 9 -- +array(4) { + [0]=> + string(7) "with %0 " + [1]=> + string(7) "and %0nu" + [2]=> + string(7) "ll char" + [3]=> + string(1) "s" +} +-- Iteration 10 -- +array(5) { + [0]=> + string(7) "with " + [1]=> + string(7) " multip" + [2]=> + string(7) "le " + [3]=> + string(7) "space c" + [4]=> + string(3) "har" +} +-- Iteration 11 -- +array(6) { + [0]=> + string(7) "Testing" + [1]=> + string(7) " invali" + [2]=> + string(7) "d \k an" + [3]=> + string(7) "d \m es" + [4]=> + string(7) "cape ch" + [5]=> + string(2) "ar" +} +-- Iteration 12 -- +array(4) { + [0]=> + string(7) "to chec" + [1]=> + string(7) "k with " + [2]=> + string(7) "\n and " + [3]=> + string(2) "\t" +} +Done diff --git a/tests/std/strings/str_split_variation4.phpt b/tests/std/strings/str_split_variation4.phpt new file mode 100644 index 00000000..b4b5cdb9 --- /dev/null +++ b/tests/std/strings/str_split_variation4.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test str_split() function : usage variations - different single quoted strings for 'str' argument +--FILE-- + +--EXPECT-- +*** Testing str_split() : single quoted strings for 'str' *** +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(1) { + [0]=> + string(1) " " +} +-- Iteration 3 -- +array(1) { + [0]=> + string(4) "1234" +} +-- Iteration 4 -- +array(3) { + [0]=> + string(5) "simpl" + [1]=> + string(5) "e str" + [2]=> + string(3) "ing" +} +-- Iteration 5 -- +array(5) { + [0]=> + string(5) "It's " + [1]=> + string(5) "strin" + [2]=> + string(5) "g wit" + [3]=> + string(5) "h quo" + [4]=> + string(2) "te" +} +-- Iteration 6 -- +array(8) { + [0]=> + string(5) "strin" + [1]=> + string(5) "g\tco" + [2]=> + string(5) "ntain" + [3]=> + string(5) "s\rwh" + [4]=> + string(5) "ite s" + [5]=> + string(5) "pace\" + [6]=> + string(5) "nchar" + [7]=> + string(1) "s" +} +-- Iteration 7 -- +array(6) { + [0]=> + string(5) "conta" + [1]=> + string(5) "ining" + [2]=> + string(5) " @ # " + [3]=> + string(5) "$ % ^" + [4]=> + string(5) " & ch" + [5]=> + string(3) "ars" +} +-- Iteration 8 -- +array(4) { + [0]=> + string(5) "with " + [1]=> + string(5) "1234 " + [2]=> + string(5) "numbe" + [3]=> + string(2) "rs" +} +-- Iteration 9 -- +array(7) { + [0]=> + string(5) "with " + [1]=> + string(5) "\0 an" + [2]=> + string(5) "d ".c" + [3]=> + string(5) "hr(0)" + [4]=> + string(5) "."nul" + [5]=> + string(5) "l cha" + [6]=> + string(2) "rs" +} +-- Iteration 10 -- +array(7) { + [0]=> + string(5) "with " + [1]=> + string(5) " mu" + [2]=> + string(5) "ltipl" + [3]=> + string(5) "e " + [4]=> + string(5) " spac" + [5]=> + string(5) "e cha" + [6]=> + string(1) "r" +} +-- Iteration 11 -- +array(8) { + [0]=> + string(5) "Testi" + [1]=> + string(5) "ng in" + [2]=> + string(5) "valid" + [3]=> + string(5) " \k a" + [4]=> + string(5) "nd \m" + [5]=> + string(5) " esca" + [6]=> + string(5) "pe ch" + [7]=> + string(2) "ar" +} +-- Iteration 12 -- +array(5) { + [0]=> + string(5) "to ch" + [1]=> + string(5) "eck w" + [2]=> + string(5) "ith \" + [3]=> + string(5) "n and" + [4]=> + string(3) " \t" +} +Done diff --git a/tests/std/strings/str_split_variation5.phpt b/tests/std/strings/str_split_variation5.phpt new file mode 100644 index 00000000..b5fc9eb0 --- /dev/null +++ b/tests/std/strings/str_split_variation5.phpt @@ -0,0 +1,169 @@ +--TEST-- +Test str_split() function : usage variations - different heredoc strings as 'str' argument +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing str_split() : heredoc strings as 'str' argument *** +-- Iteration 1 -- +array(0) { +} +-- Iteration 2 -- +array(0) { +} +-- Iteration 3 -- +array(1) { + [0]=> + string(1) "a" +} +-- Iteration 4 -- +array(3) { + [0]=> + string(10) "This is si" + [1]=> + string(10) "mple hered" + [2]=> + string(9) "oc string" +} +-- Iteration 5 -- +array(6) { + [0]=> + string(10) "This is to" + [1]=> + string(10) " check str" + [2]=> + string(10) "_split +fun" + [3]=> + string(10) "ction with" + [4]=> + string(10) " multiline" + [5]=> + string(8) " +heredoc" +} +-- Iteration 6 -- +array(4) { + [0]=> + string(10) "This check" + [1]=> + string(10) "s heredoc " + [2]=> + string(10) "with $, %," + [3]=> + string(9) " &, chars" +} +-- Iteration 7 -- +array(4) { + [0]=> + string(10) "This check" + [1]=> + string(10) "s str_spl" + [2]=> + string(10) "it() +Escap" + [3]=> + string(7) "e +chars" +} +-- Iteration 8 -- +array(8) { + [0]=> + string(10) ""To check " + [1]=> + string(10) "" in hered" + [2]=> + string(10) "oc" +I'm su" + [3]=> + string(10) "re it'll w" + [4]=> + string(10) "ork also w" + [5]=> + string(10) "ith \ +whic" + [6]=> + string(10) "h is singl" + [7]=> + string(7) "e slash" +} +Done diff --git a/tests/std/strings/str_split_variation6.phpt b/tests/std/strings/str_split_variation6.phpt new file mode 100644 index 00000000..a8c1bbf1 --- /dev/null +++ b/tests/std/strings/str_split_variation6.phpt @@ -0,0 +1,146 @@ +--TEST-- +Test str_split() function : usage variations - different integer values for 'split_length' argument +--FILE-- +getMessage() . "\n"; + } +} +?> +--EXPECT-- +*** Testing str_split() : different integer values for 'split_length' *** +-- Iteration 1 -- +str_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 2 -- +array(42) { + [0]=> + string(1) "T" + [1]=> + string(1) "h" + [2]=> + string(1) "i" + [3]=> + string(1) "s" + [4]=> + string(1) " " + [5]=> + string(1) "i" + [6]=> + string(1) "s" + [7]=> + string(1) " " + [8]=> + string(1) "a" + [9]=> + string(1) " " + [10]=> + string(1) "s" + [11]=> + string(1) "t" + [12]=> + string(1) "r" + [13]=> + string(1) "i" + [14]=> + string(1) "n" + [15]=> + string(1) "g" + [16]=> + string(1) " " + [17]=> + string(1) "w" + [18]=> + string(1) "i" + [19]=> + string(1) "t" + [20]=> + string(1) "h" + [21]=> + string(1) " " + [22]=> + string(1) "1" + [23]=> + string(1) "2" + [24]=> + string(1) "3" + [25]=> + string(1) " " + [26]=> + string(1) "&" + [27]=> + string(1) " " + [28]=> + string(1) "e" + [29]=> + string(1) "s" + [30]=> + string(1) "c" + [31]=> + string(1) "a" + [32]=> + string(1) "p" + [33]=> + string(1) "e" + [34]=> + string(1) " " + [35]=> + string(1) "c" + [36]=> + string(1) "h" + [37]=> + string(1) "a" + [38]=> + string(1) "r" + [39]=> + string(1) " " + [40]=> + string(1) "\" + [41]=> + string(1) "t" +} +-- Iteration 3 -- +str_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 4 -- +array(1) { + [0]=> + string(42) "This is a string with 123 & escape char \t" +} +-- Iteration 5 -- +array(2) { + [0]=> + string(26) "This is a string with 123 " + [1]=> + string(16) "& escape char \t" +} +-- Iteration 6 -- +array(1) { + [0]=> + string(42) "This is a string with 123 & escape char \t" +} +-- Iteration 7 -- +str_split(): Argument #2 ($length) must be greater than 0 diff --git a/tests/std/strings/str_split_variation7.phpt b/tests/std/strings/str_split_variation7.phpt new file mode 100644 index 00000000..17e802b2 --- /dev/null +++ b/tests/std/strings/str_split_variation7.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test str_split() function : usage variations - different integer values for 'split_length' with heredoc 'str' +--FILE-- +getMessage() . "\n"; + } +} +?> +--EXPECT-- +*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' *** +-- Iteration 1 -- +str_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 2 -- +array(30) { + [0]=> + string(1) "s" + [1]=> + string(1) "t" + [2]=> + string(1) "r" + [3]=> + string(1) "i" + [4]=> + string(1) "n" + [5]=> + string(1) "g" + [6]=> + string(1) " " + [7]=> + string(1) "w" + [8]=> + string(1) "i" + [9]=> + string(1) "t" + [10]=> + string(1) "h" + [11]=> + string(1) " " + [12]=> + string(1) "1" + [13]=> + string(1) "2" + [14]=> + string(1) "3" + [15]=> + string(1) "," + [16]=> + string(1) "e" + [17]=> + string(1) "s" + [18]=> + string(1) "c" + [19]=> + string(1) "a" + [20]=> + string(1) "p" + [21]=> + string(1) "e" + [22]=> + string(1) " " + [23]=> + string(1) "c" + [24]=> + string(1) "h" + [25]=> + string(1) "a" + [26]=> + string(1) "r" + [27]=> + string(1) " " + [28]=> + string(1) " " + [29]=> + string(1) "." +} +-- Iteration 3 -- +str_split(): Argument #2 ($length) must be greater than 0 +-- Iteration 4 -- +array(1) { + [0]=> + string(30) "string with 123,escape char ." +} +-- Iteration 5 -- +array(2) { + [0]=> + string(26) "string with 123,escape cha" + [1]=> + string(4) "r ." +} +-- Iteration 6 -- +array(1) { + [0]=> + string(30) "string with 123,escape char ." +} +-- Iteration 7 -- +str_split(): Argument #2 ($length) must be greater than 0 diff --git a/tests/std/strings/str_starts_with.phpt b/tests/std/strings/str_starts_with.phpt new file mode 100644 index 00000000..552b2983 --- /dev/null +++ b/tests/std/strings/str_starts_with.phpt @@ -0,0 +1,41 @@ +--TEST-- +str_starts_with() function - unit tests for str_starts_with() +--FILE-- + +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) diff --git a/tests/std/strings/str_word_count.phpt b/tests/std/strings/str_word_count.phpt new file mode 100644 index 00000000..a3cc752d --- /dev/null +++ b/tests/std/strings/str_word_count.phpt @@ -0,0 +1,235 @@ +--TEST-- +str_word_count() +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, 123)); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, -1)); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, 999999999)); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +var_dump($str); + +$str2 = "F0o B4r 1s bar foo"; +var_dump(str_word_count($str2, 0, "04")); +var_dump(str_word_count($str2, 0, "01")); +var_dump(str_word_count($str2, 0, "014")); +var_dump(str_word_count($str2, 0, "")); +var_dump(str_word_count($str2, 1, "04")); +var_dump(str_word_count($str2, 1, "01")); +var_dump(str_word_count($str2, 1, "014")); +var_dump(str_word_count($str2, 1, "")); +var_dump(str_word_count($str2, 2, "04")); +var_dump(str_word_count($str2, 2, "01")); +var_dump(str_word_count($str2, 2, "014")); +var_dump(str_word_count($str2, 2, "")); +var_dump(str_word_count("foo'0 bar-0var", 2, "0")); +var_dump(str_word_count("'foo'", 2)); +var_dump(str_word_count("'foo'", 2, "'")); +var_dump(str_word_count("-foo-", 2)); +var_dump(str_word_count("-foo-", 2, "-")); + +?> + +DONE +--EXPECT-- +array(6) { + [0]=> + string(5) "Hello" + [1]=> + string(6) "friend" + [2]=> + string(6) "you're" + [3]=> + string(7) "looking" + [4]=> + string(4) "good" + [5]=> + string(5) "today" +} +array(6) { + [0]=> + string(5) "Hello" + [6]=> + string(6) "friend" + [14]=> + string(6) "you're" + [25]=> + string(7) "looking" + [42]=> + string(4) "good" + [47]=> + string(5) "today" +} +int(6) +str_word_count(): Argument #2 ($format) must be a valid format value +str_word_count(): Argument #2 ($format) must be a valid format value +str_word_count(): Argument #2 ($format) must be a valid format value +str_word_count(): Argument #2 ($format) must be a valid format value +string(53) "Hello friend, you're + looking good today!" +int(5) +int(6) +int(5) +int(7) +array(5) { + [0]=> + string(3) "F0o" + [1]=> + string(3) "B4r" + [2]=> + string(1) "s" + [3]=> + string(3) "bar" + [4]=> + string(3) "foo" +} +array(6) { + [0]=> + string(3) "F0o" + [1]=> + string(1) "B" + [2]=> + string(1) "r" + [3]=> + string(2) "1s" + [4]=> + string(3) "bar" + [5]=> + string(3) "foo" +} +array(5) { + [0]=> + string(3) "F0o" + [1]=> + string(3) "B4r" + [2]=> + string(2) "1s" + [3]=> + string(3) "bar" + [4]=> + string(3) "foo" +} +array(7) { + [0]=> + string(1) "F" + [1]=> + string(1) "o" + [2]=> + string(1) "B" + [3]=> + string(1) "r" + [4]=> + string(1) "s" + [5]=> + string(3) "bar" + [6]=> + string(3) "foo" +} +array(5) { + [0]=> + string(3) "F0o" + [4]=> + string(3) "B4r" + [9]=> + string(1) "s" + [11]=> + string(3) "bar" + [15]=> + string(3) "foo" +} +array(6) { + [0]=> + string(3) "F0o" + [4]=> + string(1) "B" + [6]=> + string(1) "r" + [8]=> + string(2) "1s" + [11]=> + string(3) "bar" + [15]=> + string(3) "foo" +} +array(5) { + [0]=> + string(3) "F0o" + [4]=> + string(3) "B4r" + [8]=> + string(2) "1s" + [11]=> + string(3) "bar" + [15]=> + string(3) "foo" +} +array(7) { + [0]=> + string(1) "F" + [2]=> + string(1) "o" + [4]=> + string(1) "B" + [6]=> + string(1) "r" + [9]=> + string(1) "s" + [11]=> + string(3) "bar" + [15]=> + string(3) "foo" +} +array(2) { + [0]=> + string(5) "foo'0" + [6]=> + string(8) "bar-0var" +} +array(1) { + [1]=> + string(4) "foo'" +} +array(1) { + [0]=> + string(5) "'foo'" +} +array(1) { + [1]=> + string(3) "foo" +} +array(1) { + [0]=> + string(5) "-foo-" +} + +DONE diff --git a/tests/std/strings/str_word_count1.phpt b/tests/std/strings/str_word_count1.phpt new file mode 100644 index 00000000..2a488865 --- /dev/null +++ b/tests/std/strings/str_word_count1.phpt @@ -0,0 +1,34 @@ +--TEST-- +str_word_count() and invalid arguments +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} + +try { + var_dump(str_word_count("", -1, $a)); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +var_dump($a); +?> +--EXPECTF-- +int(0) +str_word_count(): Argument #2 ($format) must be a valid format value + +Warning: Undefined variable $a in %s on line %d +str_word_count(): Argument #2 ($format) must be a valid format value + +Warning: Undefined variable $a in %s on line %d +NULL diff --git a/tests/std/strings/strcasecmp.phpt b/tests/std/strings/strcasecmp.phpt new file mode 100644 index 00000000..4d597812 --- /dev/null +++ b/tests/std/strings/strcasecmp.phpt @@ -0,0 +1,565 @@ +--TEST-- +strcasecmp() function +--SKIPIF-- + +--INI-- +precision = 12 +--FILE-- + "; + var_dump(strcasecmp($str1_arr[$i], $str1_arr[$j])); + } + } +} + + + +echo "\n#### Testing miscellaneous inputs ####\n"; + +echo "--- Testing objects ---\n"; +/* we get "Recoverable fatal error: saying Object of class could not be converted + to string" by default when an object is passed instead of string. +The error can be avoided by choosing the __toString magix method as follows: */ + +class string1 { + function __toString() { + return "Hello, world"; + } +} +$obj_string1 = new string1; + +class string2 { + function __toString() { + return "hello, world\0"; + } +} +$obj_string2 = new string2; + +var_dump(strcasecmp("$obj_string1", "$obj_string2")); + + +echo "\n--- Testing arrays ---\n"; +$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!"); +var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]")); +var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]")); + + +echo "\n--- Testing a longer and heredoc string ---\n"; +$string = << +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +#### Basic and Possible operations #### +*** comparing the strings in an +Array +( + [0] => a + [1] => A + [2] => € + [3] => ÿ + [4] => %0 +) + +Iteration 0 +- strcasecmp of 'a' and 'a' is => int(0) +- strcasecmp of 'a' and 'A' is => int(0) +- strcasecmp of 'a' and '€' is => int(-%d) +- strcasecmp of 'a' and 'ÿ' is => int(-%d) +- strcasecmp of 'a' and '%0' is => int(%d) + +Iteration 1 +- strcasecmp of 'A' and 'a' is => int(0) +- strcasecmp of 'A' and 'A' is => int(0) +- strcasecmp of 'A' and '€' is => int(-%d) +- strcasecmp of 'A' and 'ÿ' is => int(-%d) +- strcasecmp of 'A' and '%0' is => int(%d) + +Iteration 2 +- strcasecmp of '€' and 'a' is => int(%d) +- strcasecmp of '€' and 'A' is => int(%d) +- strcasecmp of '€' and '€' is => int(0) +- strcasecmp of '€' and 'ÿ' is => int(-%d) +- strcasecmp of '€' and '%0' is => int(%d) + +Iteration 3 +- strcasecmp of 'ÿ' and 'a' is => int(%d) +- strcasecmp of 'ÿ' and 'A' is => int(%d) +- strcasecmp of 'ÿ' and '€' is => int(%d) +- strcasecmp of 'ÿ' and 'ÿ' is => int(0) +- strcasecmp of 'ÿ' and '%0' is => int(%d) + +Iteration 4 +- strcasecmp of '%0' and 'a' is => int(-%d) +- strcasecmp of '%0' and 'A' is => int(-%d) +- strcasecmp of '%0' and '€' is => int(-%d) +- strcasecmp of '%0' and 'ÿ' is => int(-%d) +- strcasecmp of '%0' and '%0' is => int(0) + +*** comparing the strings in an +Array +( + [0] => acc + [1] => Acc + [2] => aC + [3] => acCc + [4] => acd + [5] => ?acc + [6] => Acc! + [7] => $!acc + [8] => ;acc +) + +Iteration 0 +- strcasecmp of 'acc' and 'acc' is => int(0) +- strcasecmp of 'acc' and 'Acc' is => int(0) +- strcasecmp of 'acc' and 'aC' is => int(%d) +- strcasecmp of 'acc' and 'acCc' is => int(-%d) +- strcasecmp of 'acc' and 'acd' is => int(-%d) +- strcasecmp of 'acc' and '?acc' is => int(%d) +- strcasecmp of 'acc' and 'Acc!' is => int(-%d) +- strcasecmp of 'acc' and '$!acc' is => int(%d) +- strcasecmp of 'acc' and ';acc' is => int(%d) + +Iteration 1 +- strcasecmp of 'Acc' and 'acc' is => int(0) +- strcasecmp of 'Acc' and 'Acc' is => int(0) +- strcasecmp of 'Acc' and 'aC' is => int(%d) +- strcasecmp of 'Acc' and 'acCc' is => int(-%d) +- strcasecmp of 'Acc' and 'acd' is => int(-%d) +- strcasecmp of 'Acc' and '?acc' is => int(%d) +- strcasecmp of 'Acc' and 'Acc!' is => int(-%d) +- strcasecmp of 'Acc' and '$!acc' is => int(%d) +- strcasecmp of 'Acc' and ';acc' is => int(%d) + +Iteration 2 +- strcasecmp of 'aC' and 'acc' is => int(-%d) +- strcasecmp of 'aC' and 'Acc' is => int(-%d) +- strcasecmp of 'aC' and 'aC' is => int(0) +- strcasecmp of 'aC' and 'acCc' is => int(-%d) +- strcasecmp of 'aC' and 'acd' is => int(-%d) +- strcasecmp of 'aC' and '?acc' is => int(%d) +- strcasecmp of 'aC' and 'Acc!' is => int(-%d) +- strcasecmp of 'aC' and '$!acc' is => int(%d) +- strcasecmp of 'aC' and ';acc' is => int(%d) + +Iteration 3 +- strcasecmp of 'acCc' and 'acc' is => int(%d) +- strcasecmp of 'acCc' and 'Acc' is => int(%d) +- strcasecmp of 'acCc' and 'aC' is => int(%d) +- strcasecmp of 'acCc' and 'acCc' is => int(0) +- strcasecmp of 'acCc' and 'acd' is => int(-%d) +- strcasecmp of 'acCc' and '?acc' is => int(%d) +- strcasecmp of 'acCc' and 'Acc!' is => int(%d) +- strcasecmp of 'acCc' and '$!acc' is => int(%d) +- strcasecmp of 'acCc' and ';acc' is => int(%d) + +Iteration 4 +- strcasecmp of 'acd' and 'acc' is => int(%d) +- strcasecmp of 'acd' and 'Acc' is => int(%d) +- strcasecmp of 'acd' and 'aC' is => int(%d) +- strcasecmp of 'acd' and 'acCc' is => int(%d) +- strcasecmp of 'acd' and 'acd' is => int(0) +- strcasecmp of 'acd' and '?acc' is => int(%d) +- strcasecmp of 'acd' and 'Acc!' is => int(%d) +- strcasecmp of 'acd' and '$!acc' is => int(%d) +- strcasecmp of 'acd' and ';acc' is => int(%d) + +Iteration 5 +- strcasecmp of '?acc' and 'acc' is => int(-%d) +- strcasecmp of '?acc' and 'Acc' is => int(-%d) +- strcasecmp of '?acc' and 'aC' is => int(-%d) +- strcasecmp of '?acc' and 'acCc' is => int(-%d) +- strcasecmp of '?acc' and 'acd' is => int(-%d) +- strcasecmp of '?acc' and '?acc' is => int(0) +- strcasecmp of '?acc' and 'Acc!' is => int(-%d) +- strcasecmp of '?acc' and '$!acc' is => int(%d) +- strcasecmp of '?acc' and ';acc' is => int(%d) + +Iteration 6 +- strcasecmp of 'Acc!' and 'acc' is => int(%d) +- strcasecmp of 'Acc!' and 'Acc' is => int(%d) +- strcasecmp of 'Acc!' and 'aC' is => int(%d) +- strcasecmp of 'Acc!' and 'acCc' is => int(-%d) +- strcasecmp of 'Acc!' and 'acd' is => int(-%d) +- strcasecmp of 'Acc!' and '?acc' is => int(%d) +- strcasecmp of 'Acc!' and 'Acc!' is => int(0) +- strcasecmp of 'Acc!' and '$!acc' is => int(%d) +- strcasecmp of 'Acc!' and ';acc' is => int(%d) + +Iteration 7 +- strcasecmp of '$!acc' and 'acc' is => int(-%d) +- strcasecmp of '$!acc' and 'Acc' is => int(-%d) +- strcasecmp of '$!acc' and 'aC' is => int(-%d) +- strcasecmp of '$!acc' and 'acCc' is => int(-%d) +- strcasecmp of '$!acc' and 'acd' is => int(-%d) +- strcasecmp of '$!acc' and '?acc' is => int(-%d) +- strcasecmp of '$!acc' and 'Acc!' is => int(-%d) +- strcasecmp of '$!acc' and '$!acc' is => int(0) +- strcasecmp of '$!acc' and ';acc' is => int(-%d) + +Iteration 8 +- strcasecmp of ';acc' and 'acc' is => int(-%d) +- strcasecmp of ';acc' and 'Acc' is => int(-%d) +- strcasecmp of ';acc' and 'aC' is => int(-%d) +- strcasecmp of ';acc' and 'acCc' is => int(-%d) +- strcasecmp of ';acc' and 'acd' is => int(-%d) +- strcasecmp of ';acc' and '?acc' is => int(-%d) +- strcasecmp of ';acc' and 'Acc!' is => int(-%d) +- strcasecmp of ';acc' and '$!acc' is => int(%d) +- strcasecmp of ';acc' and ';acc' is => int(0) + +*** comparing the strings in an +Array +( + [0] => 1 + [1] => 0 + [2] => 0 + [3] => -1 + [4] => -1 + [5] => + [6] => 1 + [7] => 1 + [8] => + [9] => string +) + +Iteration 0 +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and 'string' is => int(-%d) + +Iteration 1 +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '0' is => int(0) +- strcasecmp of '0' and '0' is => int(0) +- strcasecmp of '0' and '-1' is => int(%d) +- strcasecmp of '0' and '-1' is => int(%d) +- strcasecmp of '0' and '' is => int(%d) +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '' is => int(%d) +- strcasecmp of '0' and 'string' is => int(-%d) + +Iteration 2 +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '0' is => int(0) +- strcasecmp of '0' and '0' is => int(0) +- strcasecmp of '0' and '-1' is => int(%d) +- strcasecmp of '0' and '-1' is => int(%d) +- strcasecmp of '0' and '' is => int(%d) +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '1' is => int(-%d) +- strcasecmp of '0' and '' is => int(%d) +- strcasecmp of '0' and 'string' is => int(-%d) + +Iteration 3 +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '0' is => int(-%d) +- strcasecmp of '-1' and '0' is => int(-%d) +- strcasecmp of '-1' and '-1' is => int(0) +- strcasecmp of '-1' and '-1' is => int(0) +- strcasecmp of '-1' and '' is => int(%d) +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '' is => int(%d) +- strcasecmp of '-1' and 'string' is => int(-%d) + +Iteration 4 +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '0' is => int(-%d) +- strcasecmp of '-1' and '0' is => int(-%d) +- strcasecmp of '-1' and '-1' is => int(0) +- strcasecmp of '-1' and '-1' is => int(0) +- strcasecmp of '-1' and '' is => int(%d) +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '1' is => int(-%d) +- strcasecmp of '-1' and '' is => int(%d) +- strcasecmp of '-1' and 'string' is => int(-%d) + +Iteration 5 +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '0' is => int(-%d) +- strcasecmp of '' and '0' is => int(-%d) +- strcasecmp of '' and '-1' is => int(-%d) +- strcasecmp of '' and '-1' is => int(-%d) +- strcasecmp of '' and '' is => int(0) +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '' is => int(0) +- strcasecmp of '' and 'string' is => int(-%d) + +Iteration 6 +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and 'string' is => int(-%d) + +Iteration 7 +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '0' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '-1' is => int(%d) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '1' is => int(0) +- strcasecmp of '1' and '' is => int(%d) +- strcasecmp of '1' and 'string' is => int(-%d) + +Iteration 8 +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '0' is => int(-%d) +- strcasecmp of '' and '0' is => int(-%d) +- strcasecmp of '' and '-1' is => int(-%d) +- strcasecmp of '' and '-1' is => int(-%d) +- strcasecmp of '' and '' is => int(0) +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '1' is => int(-%d) +- strcasecmp of '' and '' is => int(0) +- strcasecmp of '' and 'string' is => int(-%d) + +Iteration 9 +- strcasecmp of 'string' and '1' is => int(%d) +- strcasecmp of 'string' and '0' is => int(%d) +- strcasecmp of 'string' and '0' is => int(%d) +- strcasecmp of 'string' and '-1' is => int(%d) +- strcasecmp of 'string' and '-1' is => int(%d) +- strcasecmp of 'string' and '' is => int(%d) +- strcasecmp of 'string' and '1' is => int(%d) +- strcasecmp of 'string' and '1' is => int(%d) +- strcasecmp of 'string' and '' is => int(%d) +- strcasecmp of 'string' and 'string' is => int(0) + +*** comparing the strings in an +Array +( + [0] => 10.5 + [1] => 1.5 + [2] => 9.5 + [3] => 11.5 + [4] => 100.5 + [5] => 105 + [6] => -10.5 + [7] => 10 + [8] => 0.5 +) + +Iteration 0 +- strcasecmp of '10.5' and '10.5' is => int(0) +- strcasecmp of '10.5' and '1.5' is => int(%d) +- strcasecmp of '10.5' and '9.5' is => int(-%d) +- strcasecmp of '10.5' and '11.5' is => int(-%d) +- strcasecmp of '10.5' and '100.5' is => int(-%d) +- strcasecmp of '10.5' and '105' is => int(-%d) +- strcasecmp of '10.5' and '-10.5' is => int(%d) +- strcasecmp of '10.5' and '10' is => int(%d) +- strcasecmp of '10.5' and '0.5' is => int(%d) + +Iteration 1 +- strcasecmp of '1.5' and '10.5' is => int(-%d) +- strcasecmp of '1.5' and '1.5' is => int(0) +- strcasecmp of '1.5' and '9.5' is => int(-%d) +- strcasecmp of '1.5' and '11.5' is => int(-%d) +- strcasecmp of '1.5' and '100.5' is => int(-%d) +- strcasecmp of '1.5' and '105' is => int(-%d) +- strcasecmp of '1.5' and '-10.5' is => int(%d) +- strcasecmp of '1.5' and '10' is => int(-%d) +- strcasecmp of '1.5' and '0.5' is => int(%d) + +Iteration 2 +- strcasecmp of '9.5' and '10.5' is => int(%d) +- strcasecmp of '9.5' and '1.5' is => int(%d) +- strcasecmp of '9.5' and '9.5' is => int(0) +- strcasecmp of '9.5' and '11.5' is => int(%d) +- strcasecmp of '9.5' and '100.5' is => int(%d) +- strcasecmp of '9.5' and '105' is => int(%d) +- strcasecmp of '9.5' and '-10.5' is => int(%d) +- strcasecmp of '9.5' and '10' is => int(%d) +- strcasecmp of '9.5' and '0.5' is => int(%d) + +Iteration 3 +- strcasecmp of '11.5' and '10.5' is => int(%d) +- strcasecmp of '11.5' and '1.5' is => int(%d) +- strcasecmp of '11.5' and '9.5' is => int(-%d) +- strcasecmp of '11.5' and '11.5' is => int(0) +- strcasecmp of '11.5' and '100.5' is => int(%d) +- strcasecmp of '11.5' and '105' is => int(%d) +- strcasecmp of '11.5' and '-10.5' is => int(%d) +- strcasecmp of '11.5' and '10' is => int(%d) +- strcasecmp of '11.5' and '0.5' is => int(%d) + +Iteration 4 +- strcasecmp of '100.5' and '10.5' is => int(%d) +- strcasecmp of '100.5' and '1.5' is => int(%d) +- strcasecmp of '100.5' and '9.5' is => int(-%d) +- strcasecmp of '100.5' and '11.5' is => int(-%d) +- strcasecmp of '100.5' and '100.5' is => int(0) +- strcasecmp of '100.5' and '105' is => int(-%d) +- strcasecmp of '100.5' and '-10.5' is => int(%d) +- strcasecmp of '100.5' and '10' is => int(%d) +- strcasecmp of '100.5' and '0.5' is => int(%d) + +Iteration 5 +- strcasecmp of '105' and '10.5' is => int(%d) +- strcasecmp of '105' and '1.5' is => int(%d) +- strcasecmp of '105' and '9.5' is => int(-%d) +- strcasecmp of '105' and '11.5' is => int(-%d) +- strcasecmp of '105' and '100.5' is => int(%d) +- strcasecmp of '105' and '105' is => int(0) +- strcasecmp of '105' and '-10.5' is => int(%d) +- strcasecmp of '105' and '10' is => int(%d) +- strcasecmp of '105' and '0.5' is => int(%d) + +Iteration 6 +- strcasecmp of '-10.5' and '10.5' is => int(-%d) +- strcasecmp of '-10.5' and '1.5' is => int(-%d) +- strcasecmp of '-10.5' and '9.5' is => int(-%d) +- strcasecmp of '-10.5' and '11.5' is => int(-%d) +- strcasecmp of '-10.5' and '100.5' is => int(-%d) +- strcasecmp of '-10.5' and '105' is => int(-%d) +- strcasecmp of '-10.5' and '-10.5' is => int(0) +- strcasecmp of '-10.5' and '10' is => int(-%d) +- strcasecmp of '-10.5' and '0.5' is => int(-%d) + +Iteration 7 +- strcasecmp of '10' and '10.5' is => int(-%d) +- strcasecmp of '10' and '1.5' is => int(%d) +- strcasecmp of '10' and '9.5' is => int(-%d) +- strcasecmp of '10' and '11.5' is => int(-%d) +- strcasecmp of '10' and '100.5' is => int(-%d) +- strcasecmp of '10' and '105' is => int(-%d) +- strcasecmp of '10' and '-10.5' is => int(%d) +- strcasecmp of '10' and '10' is => int(0) +- strcasecmp of '10' and '0.5' is => int(%d) + +Iteration 8 +- strcasecmp of '0.5' and '10.5' is => int(-%d) +- strcasecmp of '0.5' and '1.5' is => int(-%d) +- strcasecmp of '0.5' and '9.5' is => int(-%d) +- strcasecmp of '0.5' and '11.5' is => int(-%d) +- strcasecmp of '0.5' and '100.5' is => int(-%d) +- strcasecmp of '0.5' and '105' is => int(-%d) +- strcasecmp of '0.5' and '-10.5' is => int(%d) +- strcasecmp of '0.5' and '10' is => int(-%d) +- strcasecmp of '0.5' and '0.5' is => int(0) + +#### Testing miscellaneous inputs #### +--- Testing objects --- +int(-%d) + +--- Testing arrays --- +int(%d) +int(%d) + +--- Testing a longer and heredoc string --- +int(0) +int(-%d) +int(%d) + +--- Testing a heredoc null string --- +int(-%d) +int(-%d) + +--- Testing simple and complex syntax strings --- +int(-%d) +int(-%d) + +Warning: Undefined variable $strS in %s on line %d +int(%d) +int(-%d) +int(-%d) + +--- Testing binary safe and binary chars --- +int(%d) +int(-%d) +int(0) +int(0) +int(%d) + +--- Comparing long float values --- +int(0) +int(-%d) +int(0) +Done diff --git a/tests/std/strings/strcmp.phpt b/tests/std/strings/strcmp.phpt new file mode 100644 index 00000000..656589e6 --- /dev/null +++ b/tests/std/strings/strcmp.phpt @@ -0,0 +1,573 @@ +--TEST-- +strcmp() function +--SKIPIF-- + +--INI-- +precision = 12 +--FILE-- + "; + var_dump(strcmp($str1_arr[$i], $str1_arr[$j])); + } + } +} + + + +echo "\n#### Testing miscellaneous inputs ####\n"; + +echo "--- Testing objects ---\n"; +/* we get "Recoverable fatal error: saying Object of class could not be converted + to string" by default, when an object is passed instead of string. +The error can be avoided by choosing the __toString magix method as follows: */ + +class string1 { + function __toString() { + return "Hello, world"; + } +} +$obj_string1 = new string1; + +class string2 { + function __toString() { + return "Hello, world\0"; + } +} +$obj_string2 = new string2; + +var_dump(strcmp("$obj_string1", "$obj_string2")); + + +echo "\n--- Testing arrays ---\n"; +$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!"); +var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]")); +var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]")); + + +echo "\n--- Testing a longer and heredoc string ---\n"; +$string = << +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +#### Basic and Possible operations #### +*** comparing the strings in an +Array +( + [0] => a + [1] => A + [2] => a + [3] => A + [4] => € + [5] => ÿ + [6] => %0 +) + +Iteration 0 +- strcmp of 'a' and 'a' is => int(0) +- strcmp of 'a' and 'A' is => int(%d) +- strcmp of 'a' and 'a' is => int(0) +- strcmp of 'a' and 'A' is => int(%d) +- strcmp of 'a' and '€' is => int(-%d) +- strcmp of 'a' and 'ÿ' is => int(-%d) +- strcmp of 'a' and '%0' is => int(%d) + +Iteration 1 +- strcmp of 'A' and 'a' is => int(-%d) +- strcmp of 'A' and 'A' is => int(0) +- strcmp of 'A' and 'a' is => int(-%d) +- strcmp of 'A' and 'A' is => int(0) +- strcmp of 'A' and '€' is => int(-%d) +- strcmp of 'A' and 'ÿ' is => int(-%d) +- strcmp of 'A' and '%0' is => int(%d) + +Iteration 2 +- strcmp of 'a' and 'a' is => int(0) +- strcmp of 'a' and 'A' is => int(%d) +- strcmp of 'a' and 'a' is => int(0) +- strcmp of 'a' and 'A' is => int(%d) +- strcmp of 'a' and '€' is => int(-%d) +- strcmp of 'a' and 'ÿ' is => int(-%d) +- strcmp of 'a' and '%0' is => int(%d) + +Iteration 3 +- strcmp of 'A' and 'a' is => int(-%d) +- strcmp of 'A' and 'A' is => int(0) +- strcmp of 'A' and 'a' is => int(-%d) +- strcmp of 'A' and 'A' is => int(0) +- strcmp of 'A' and '€' is => int(-%d) +- strcmp of 'A' and 'ÿ' is => int(-%d) +- strcmp of 'A' and '%0' is => int(%d) + +Iteration 4 +- strcmp of '€' and 'a' is => int(%d) +- strcmp of '€' and 'A' is => int(%d) +- strcmp of '€' and 'a' is => int(%d) +- strcmp of '€' and 'A' is => int(%d) +- strcmp of '€' and '€' is => int(0) +- strcmp of '€' and 'ÿ' is => int(-%d) +- strcmp of '€' and '%0' is => int(%d) + +Iteration 5 +- strcmp of 'ÿ' and 'a' is => int(%d) +- strcmp of 'ÿ' and 'A' is => int(%d) +- strcmp of 'ÿ' and 'a' is => int(%d) +- strcmp of 'ÿ' and 'A' is => int(%d) +- strcmp of 'ÿ' and '€' is => int(%d) +- strcmp of 'ÿ' and 'ÿ' is => int(0) +- strcmp of 'ÿ' and '%0' is => int(%d) + +Iteration 6 +- strcmp of '%0' and 'a' is => int(-%d) +- strcmp of '%0' and 'A' is => int(-%d) +- strcmp of '%0' and 'a' is => int(-%d) +- strcmp of '%0' and 'A' is => int(-%d) +- strcmp of '%0' and '€' is => int(-%d) +- strcmp of '%0' and 'ÿ' is => int(-%d) +- strcmp of '%0' and '%0' is => int(0) + +*** comparing the strings in an +Array +( + [0] => acc + [1] => Acc + [2] => ac + [3] => accc + [4] => acd + [5] => ?acc + [6] => acc! + [7] => $!acc + [8] => ;acc +) + +Iteration 0 +- strcmp of 'acc' and 'acc' is => int(0) +- strcmp of 'acc' and 'Acc' is => int(%d) +- strcmp of 'acc' and 'ac' is => int(%d) +- strcmp of 'acc' and 'accc' is => int(-%d) +- strcmp of 'acc' and 'acd' is => int(-%d) +- strcmp of 'acc' and '?acc' is => int(%d) +- strcmp of 'acc' and 'acc!' is => int(-%d) +- strcmp of 'acc' and '$!acc' is => int(%d) +- strcmp of 'acc' and ';acc' is => int(%d) + +Iteration 1 +- strcmp of 'Acc' and 'acc' is => int(-%d) +- strcmp of 'Acc' and 'Acc' is => int(0) +- strcmp of 'Acc' and 'ac' is => int(-%d) +- strcmp of 'Acc' and 'accc' is => int(-%d) +- strcmp of 'Acc' and 'acd' is => int(-%d) +- strcmp of 'Acc' and '?acc' is => int(%d) +- strcmp of 'Acc' and 'acc!' is => int(-%d) +- strcmp of 'Acc' and '$!acc' is => int(%d) +- strcmp of 'Acc' and ';acc' is => int(%d) + +Iteration 2 +- strcmp of 'ac' and 'acc' is => int(-%d) +- strcmp of 'ac' and 'Acc' is => int(%d) +- strcmp of 'ac' and 'ac' is => int(0) +- strcmp of 'ac' and 'accc' is => int(-%d) +- strcmp of 'ac' and 'acd' is => int(-%d) +- strcmp of 'ac' and '?acc' is => int(%d) +- strcmp of 'ac' and 'acc!' is => int(-%d) +- strcmp of 'ac' and '$!acc' is => int(%d) +- strcmp of 'ac' and ';acc' is => int(%d) + +Iteration 3 +- strcmp of 'accc' and 'acc' is => int(%d) +- strcmp of 'accc' and 'Acc' is => int(%d) +- strcmp of 'accc' and 'ac' is => int(%d) +- strcmp of 'accc' and 'accc' is => int(0) +- strcmp of 'accc' and 'acd' is => int(-%d) +- strcmp of 'accc' and '?acc' is => int(%d) +- strcmp of 'accc' and 'acc!' is => int(%d) +- strcmp of 'accc' and '$!acc' is => int(%d) +- strcmp of 'accc' and ';acc' is => int(%d) + +Iteration 4 +- strcmp of 'acd' and 'acc' is => int(%d) +- strcmp of 'acd' and 'Acc' is => int(%d) +- strcmp of 'acd' and 'ac' is => int(%d) +- strcmp of 'acd' and 'accc' is => int(%d) +- strcmp of 'acd' and 'acd' is => int(0) +- strcmp of 'acd' and '?acc' is => int(%d) +- strcmp of 'acd' and 'acc!' is => int(%d) +- strcmp of 'acd' and '$!acc' is => int(%d) +- strcmp of 'acd' and ';acc' is => int(%d) + +Iteration 5 +- strcmp of '?acc' and 'acc' is => int(-%d) +- strcmp of '?acc' and 'Acc' is => int(-%d) +- strcmp of '?acc' and 'ac' is => int(-%d) +- strcmp of '?acc' and 'accc' is => int(-%d) +- strcmp of '?acc' and 'acd' is => int(-%d) +- strcmp of '?acc' and '?acc' is => int(0) +- strcmp of '?acc' and 'acc!' is => int(-%d) +- strcmp of '?acc' and '$!acc' is => int(%d) +- strcmp of '?acc' and ';acc' is => int(%d) + +Iteration 6 +- strcmp of 'acc!' and 'acc' is => int(%d) +- strcmp of 'acc!' and 'Acc' is => int(%d) +- strcmp of 'acc!' and 'ac' is => int(%d) +- strcmp of 'acc!' and 'accc' is => int(-%d) +- strcmp of 'acc!' and 'acd' is => int(-%d) +- strcmp of 'acc!' and '?acc' is => int(%d) +- strcmp of 'acc!' and 'acc!' is => int(0) +- strcmp of 'acc!' and '$!acc' is => int(%d) +- strcmp of 'acc!' and ';acc' is => int(%d) + +Iteration 7 +- strcmp of '$!acc' and 'acc' is => int(-%d) +- strcmp of '$!acc' and 'Acc' is => int(-%d) +- strcmp of '$!acc' and 'ac' is => int(-%d) +- strcmp of '$!acc' and 'accc' is => int(-%d) +- strcmp of '$!acc' and 'acd' is => int(-%d) +- strcmp of '$!acc' and '?acc' is => int(-%d) +- strcmp of '$!acc' and 'acc!' is => int(-%d) +- strcmp of '$!acc' and '$!acc' is => int(0) +- strcmp of '$!acc' and ';acc' is => int(-%d) + +Iteration 8 +- strcmp of ';acc' and 'acc' is => int(-%d) +- strcmp of ';acc' and 'Acc' is => int(-%d) +- strcmp of ';acc' and 'ac' is => int(-%d) +- strcmp of ';acc' and 'accc' is => int(-%d) +- strcmp of ';acc' and 'acd' is => int(-%d) +- strcmp of ';acc' and '?acc' is => int(-%d) +- strcmp of ';acc' and 'acc!' is => int(-%d) +- strcmp of ';acc' and '$!acc' is => int(%d) +- strcmp of ';acc' and ';acc' is => int(0) + +*** comparing the strings in an +Array +( + [0] => 1 + [1] => 0 + [2] => 0 + [3] => -1 + [4] => -1 + [5] => + [6] => 1 + [7] => + [8] => string +) + +Iteration 0 +- strcmp of '1' and '1' is => int(0) +- strcmp of '1' and '0' is => int(%d) +- strcmp of '1' and '0' is => int(%d) +- strcmp of '1' and '-1' is => int(%d) +- strcmp of '1' and '-1' is => int(%d) +- strcmp of '1' and '' is => int(%d) +- strcmp of '1' and '1' is => int(0) +- strcmp of '1' and '' is => int(%d) +- strcmp of '1' and 'string' is => int(-%d) + +Iteration 1 +- strcmp of '0' and '1' is => int(-%d) +- strcmp of '0' and '0' is => int(0) +- strcmp of '0' and '0' is => int(0) +- strcmp of '0' and '-1' is => int(%d) +- strcmp of '0' and '-1' is => int(%d) +- strcmp of '0' and '' is => int(%d) +- strcmp of '0' and '1' is => int(-%d) +- strcmp of '0' and '' is => int(%d) +- strcmp of '0' and 'string' is => int(-%d) + +Iteration 2 +- strcmp of '0' and '1' is => int(-%d) +- strcmp of '0' and '0' is => int(0) +- strcmp of '0' and '0' is => int(0) +- strcmp of '0' and '-1' is => int(%d) +- strcmp of '0' and '-1' is => int(%d) +- strcmp of '0' and '' is => int(%d) +- strcmp of '0' and '1' is => int(-%d) +- strcmp of '0' and '' is => int(%d) +- strcmp of '0' and 'string' is => int(-%d) + +Iteration 3 +- strcmp of '-1' and '1' is => int(-%d) +- strcmp of '-1' and '0' is => int(-%d) +- strcmp of '-1' and '0' is => int(-%d) +- strcmp of '-1' and '-1' is => int(0) +- strcmp of '-1' and '-1' is => int(0) +- strcmp of '-1' and '' is => int(%d) +- strcmp of '-1' and '1' is => int(-%d) +- strcmp of '-1' and '' is => int(%d) +- strcmp of '-1' and 'string' is => int(-%d) + +Iteration 4 +- strcmp of '-1' and '1' is => int(-%d) +- strcmp of '-1' and '0' is => int(-%d) +- strcmp of '-1' and '0' is => int(-%d) +- strcmp of '-1' and '-1' is => int(0) +- strcmp of '-1' and '-1' is => int(0) +- strcmp of '-1' and '' is => int(%d) +- strcmp of '-1' and '1' is => int(-%d) +- strcmp of '-1' and '' is => int(%d) +- strcmp of '-1' and 'string' is => int(-%d) + +Iteration 5 +- strcmp of '' and '1' is => int(-%d) +- strcmp of '' and '0' is => int(-%d) +- strcmp of '' and '0' is => int(-%d) +- strcmp of '' and '-1' is => int(-%d) +- strcmp of '' and '-1' is => int(-%d) +- strcmp of '' and '' is => int(0) +- strcmp of '' and '1' is => int(-%d) +- strcmp of '' and '' is => int(0) +- strcmp of '' and 'string' is => int(-%d) + +Iteration 6 +- strcmp of '1' and '1' is => int(0) +- strcmp of '1' and '0' is => int(%d) +- strcmp of '1' and '0' is => int(%d) +- strcmp of '1' and '-1' is => int(%d) +- strcmp of '1' and '-1' is => int(%d) +- strcmp of '1' and '' is => int(%d) +- strcmp of '1' and '1' is => int(0) +- strcmp of '1' and '' is => int(%d) +- strcmp of '1' and 'string' is => int(-%d) + +Iteration 7 +- strcmp of '' and '1' is => int(-%d) +- strcmp of '' and '0' is => int(-%d) +- strcmp of '' and '0' is => int(-%d) +- strcmp of '' and '-1' is => int(-%d) +- strcmp of '' and '-1' is => int(-%d) +- strcmp of '' and '' is => int(0) +- strcmp of '' and '1' is => int(-%d) +- strcmp of '' and '' is => int(0) +- strcmp of '' and 'string' is => int(-%d) + +Iteration 8 +- strcmp of 'string' and '1' is => int(%d) +- strcmp of 'string' and '0' is => int(%d) +- strcmp of 'string' and '0' is => int(%d) +- strcmp of 'string' and '-1' is => int(%d) +- strcmp of 'string' and '-1' is => int(%d) +- strcmp of 'string' and '' is => int(%d) +- strcmp of 'string' and '1' is => int(%d) +- strcmp of 'string' and '' is => int(%d) +- strcmp of 'string' and 'string' is => int(0) + +*** comparing the strings in an +Array +( + [0] => 10.5 + [1] => 1.5 + [2] => 9.5 + [3] => 11.5 + [4] => 100.5 + [5] => 105 + [6] => -10.5 + [7] => 10 + [8] => 0.5 +) + +Iteration 0 +- strcmp of '10.5' and '10.5' is => int(0) +- strcmp of '10.5' and '1.5' is => int(%d) +- strcmp of '10.5' and '9.5' is => int(-%d) +- strcmp of '10.5' and '11.5' is => int(-%d) +- strcmp of '10.5' and '100.5' is => int(-%d) +- strcmp of '10.5' and '105' is => int(-%d) +- strcmp of '10.5' and '-10.5' is => int(%d) +- strcmp of '10.5' and '10' is => int(%d) +- strcmp of '10.5' and '0.5' is => int(%d) + +Iteration 1 +- strcmp of '1.5' and '10.5' is => int(-%d) +- strcmp of '1.5' and '1.5' is => int(0) +- strcmp of '1.5' and '9.5' is => int(-%d) +- strcmp of '1.5' and '11.5' is => int(-%d) +- strcmp of '1.5' and '100.5' is => int(-%d) +- strcmp of '1.5' and '105' is => int(-%d) +- strcmp of '1.5' and '-10.5' is => int(%d) +- strcmp of '1.5' and '10' is => int(-%d) +- strcmp of '1.5' and '0.5' is => int(%d) + +Iteration 2 +- strcmp of '9.5' and '10.5' is => int(%d) +- strcmp of '9.5' and '1.5' is => int(%d) +- strcmp of '9.5' and '9.5' is => int(0) +- strcmp of '9.5' and '11.5' is => int(%d) +- strcmp of '9.5' and '100.5' is => int(%d) +- strcmp of '9.5' and '105' is => int(%d) +- strcmp of '9.5' and '-10.5' is => int(%d) +- strcmp of '9.5' and '10' is => int(%d) +- strcmp of '9.5' and '0.5' is => int(%d) + +Iteration 3 +- strcmp of '11.5' and '10.5' is => int(%d) +- strcmp of '11.5' and '1.5' is => int(%d) +- strcmp of '11.5' and '9.5' is => int(-%d) +- strcmp of '11.5' and '11.5' is => int(0) +- strcmp of '11.5' and '100.5' is => int(%d) +- strcmp of '11.5' and '105' is => int(%d) +- strcmp of '11.5' and '-10.5' is => int(%d) +- strcmp of '11.5' and '10' is => int(%d) +- strcmp of '11.5' and '0.5' is => int(%d) + +Iteration 4 +- strcmp of '100.5' and '10.5' is => int(%d) +- strcmp of '100.5' and '1.5' is => int(%d) +- strcmp of '100.5' and '9.5' is => int(-%d) +- strcmp of '100.5' and '11.5' is => int(-%d) +- strcmp of '100.5' and '100.5' is => int(0) +- strcmp of '100.5' and '105' is => int(-%d) +- strcmp of '100.5' and '-10.5' is => int(%d) +- strcmp of '100.5' and '10' is => int(%d) +- strcmp of '100.5' and '0.5' is => int(%d) + +Iteration 5 +- strcmp of '105' and '10.5' is => int(%d) +- strcmp of '105' and '1.5' is => int(%d) +- strcmp of '105' and '9.5' is => int(-%d) +- strcmp of '105' and '11.5' is => int(-%d) +- strcmp of '105' and '100.5' is => int(%d) +- strcmp of '105' and '105' is => int(0) +- strcmp of '105' and '-10.5' is => int(%d) +- strcmp of '105' and '10' is => int(%d) +- strcmp of '105' and '0.5' is => int(%d) + +Iteration 6 +- strcmp of '-10.5' and '10.5' is => int(-%d) +- strcmp of '-10.5' and '1.5' is => int(-%d) +- strcmp of '-10.5' and '9.5' is => int(-%d) +- strcmp of '-10.5' and '11.5' is => int(-%d) +- strcmp of '-10.5' and '100.5' is => int(-%d) +- strcmp of '-10.5' and '105' is => int(-%d) +- strcmp of '-10.5' and '-10.5' is => int(0) +- strcmp of '-10.5' and '10' is => int(-%d) +- strcmp of '-10.5' and '0.5' is => int(-%d) + +Iteration 7 +- strcmp of '10' and '10.5' is => int(-%d) +- strcmp of '10' and '1.5' is => int(%d) +- strcmp of '10' and '9.5' is => int(-%d) +- strcmp of '10' and '11.5' is => int(-%d) +- strcmp of '10' and '100.5' is => int(-%d) +- strcmp of '10' and '105' is => int(-%d) +- strcmp of '10' and '-10.5' is => int(%d) +- strcmp of '10' and '10' is => int(0) +- strcmp of '10' and '0.5' is => int(%d) + +Iteration 8 +- strcmp of '0.5' and '10.5' is => int(-%d) +- strcmp of '0.5' and '1.5' is => int(-%d) +- strcmp of '0.5' and '9.5' is => int(-%d) +- strcmp of '0.5' and '11.5' is => int(-%d) +- strcmp of '0.5' and '100.5' is => int(-%d) +- strcmp of '0.5' and '105' is => int(-%d) +- strcmp of '0.5' and '-10.5' is => int(%d) +- strcmp of '0.5' and '10' is => int(-%d) +- strcmp of '0.5' and '0.5' is => int(0) + +#### Testing miscellaneous inputs #### +--- Testing objects --- +int(-%d) + +--- Testing arrays --- +int(%d) +int(%d) + +--- Testing a longer and heredoc string --- +int(0) +int(-%d) +int(%d) + +--- Testing a heredoc null string --- +int(-%d) +int(-%d) + +--- Testing simple and complex syntax strings --- +int(-%d) +int(-%d) + +Warning: Undefined variable $strS in %s on line %d +int(%d) +int(-%d) +int(-%d) + +--- Testing binary safe and binary chars --- +int(%d) +int(-%d) +int(0) +int(0) +int(%d) + +--- Comparing long float values --- +int(0) +int(-%d) +int(0) +Done diff --git a/tests/std/strings/strcmp_unterminated.phpt b/tests/std/strings/strcmp_unterminated.phpt new file mode 100644 index 00000000..67f3e242 --- /dev/null +++ b/tests/std/strings/strcmp_unterminated.phpt @@ -0,0 +1,18 @@ +--TEST-- +strnat(case)cmp(): potential OOB access for unterminated strings +--EXTENSIONS-- +zend_test +--FILE-- + +--EXPECT-- +int(-1) +int(1) diff --git a/tests/std/strings/strcoll.phpt b/tests/std/strings/strcoll.phpt new file mode 100644 index 00000000..d1d3df11 --- /dev/null +++ b/tests/std/strings/strcoll.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing Basic behaviour of strcoll() +--CREDITS-- +Sebastian Schürmann +sebs@php.net +Testfest 2009 Munich +--FILE-- + 0) { + echo "Pass\n"; +} +?> +--EXPECT-- +Pass diff --git a/tests/std/strings/strcspn.phpt b/tests/std/strings/strcspn.phpt new file mode 100644 index 00000000..d948655e --- /dev/null +++ b/tests/std/strings/strcspn.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test strcspn() behavior +--FILE-- + +--EXPECT-- +string(25) "22222222aaaa bbb1111 cccc" +string(4) "1234" +int(0) +int(7) +int(6) +int(0) diff --git a/tests/std/strings/strcspn_basic.phpt b/tests/std/strings/strcspn_basic.phpt new file mode 100644 index 00000000..08fdeca5 --- /dev/null +++ b/tests/std/strings/strcspn_basic.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strcspn() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strcspn() : basic functionality *** +int(2) +int(2) +int(3) +Done diff --git a/tests/std/strings/strcspn_variation10.phpt b/tests/std/strings/strcspn_variation10.phpt new file mode 100644 index 00000000..894bc179 --- /dev/null +++ b/tests/std/strings/strcspn_variation10.phpt @@ -0,0 +1,265 @@ +--TEST-- +Test strcspn() function : usage variations - with varying mask & default start and len args +--FILE-- + +--EXPECT-- +*** Testing strcspn() : with different mask strings and default start and len arguments *** + +-- Itearation 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Itearation 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Itearation 3 -- +int(1) +int(1) +int(0) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(0) + +-- Itearation 4 -- +int(2) +int(2) +int(0) +int(0) +int(2) +int(0) +int(0) +int(0) +int(2) +int(0) + +-- Itearation 5 -- +int(24) +int(24) +int(2) +int(2) +int(5) +int(24) +int(24) +int(5) +int(5) +int(5) + +-- Itearation 6 -- +int(28) +int(28) +int(2) +int(2) +int(28) +int(5) +int(5) +int(5) +int(28) +int(5) + +-- Itearation 7 -- +int(20) +int(20) +int(6) +int(6) +int(16) +int(20) +int(20) +int(16) +int(16) +int(16) + +-- Itearation 8 -- +int(21) +int(21) +int(6) +int(6) +int(21) +int(16) +int(16) +int(16) +int(21) +int(16) + +-- Itearation 9 -- +int(12) +int(12) +int(2) +int(2) +int(12) +int(12) +int(12) +int(12) +int(12) +int(11) + +-- Itearation 10 -- +int(16) +int(16) +int(2) +int(2) +int(16) +int(5) +int(5) +int(5) +int(16) +int(5) + +-- Itearation 11 -- +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) + +-- Itearation 12 -- +int(13) +int(13) +int(3) +int(3) +int(13) +int(13) +int(13) +int(13) +int(13) +int(13) + +-- Itearation 13 -- +int(14) +int(14) +int(3) +int(3) +int(14) +int(6) +int(6) +int(6) +int(14) +int(6) + +-- Itearation 14 -- +int(11) +int(11) +int(2) +int(2) +int(11) +int(11) +int(11) +int(11) +int(11) +int(11) + +-- Itearation 15 -- +int(11) +int(11) +int(2) +int(2) +int(11) +int(11) +int(11) +int(11) +int(11) +int(11) + +-- Itearation 16 -- +int(14) +int(14) +int(2) +int(2) +int(14) +int(14) +int(14) +int(14) +int(14) +int(6) + +-- Itearation 17 -- +int(21) +int(21) +int(2) +int(2) +int(21) +int(5) +int(5) +int(5) +int(21) +int(5) +Done diff --git a/tests/std/strings/strcspn_variation11.phpt b/tests/std/strings/strcspn_variation11.phpt new file mode 100644 index 00000000..6d5fda8b --- /dev/null +++ b/tests/std/strings/strcspn_variation11.phpt @@ -0,0 +1,1299 @@ +--TEST-- +Test strcspn() function : usage variations - with varying start and default len args +--FILE-- + +--EXPECT-- +*** Testing strcspn() : with different start and default len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 4 -- +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) + +-- Iteration 5 -- +int(24) +int(23) +int(22) +int(1) +int(2) +int(0) +int(24) +int(24) +int(23) +int(22) +int(1) +int(2) +int(0) +int(24) +int(2) +int(1) +int(0) +int(0) +int(1) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(24) +int(23) +int(22) +int(1) +int(2) +int(0) +int(24) +int(24) +int(23) +int(22) +int(1) +int(2) +int(0) +int(24) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(0) +int(1) +int(0) +int(5) + +-- Iteration 6 -- +int(28) +int(27) +int(26) +int(1) +int(2) +int(0) +int(28) +int(28) +int(27) +int(26) +int(1) +int(2) +int(0) +int(28) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(2) +int(1) +int(0) +int(0) +int(0) +int(0) +int(2) +int(28) +int(27) +int(26) +int(1) +int(2) +int(0) +int(28) +int(5) +int(4) +int(3) +int(1) +int(0) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(0) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(0) +int(0) +int(5) +int(28) +int(27) +int(26) +int(1) +int(2) +int(0) +int(28) +int(5) +int(4) +int(3) +int(1) +int(0) +int(0) +int(5) + +-- Iteration 7 -- +int(20) +int(19) +int(18) +int(1) +int(2) +int(0) +int(20) +int(20) +int(19) +int(18) +int(1) +int(2) +int(0) +int(20) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(20) +int(19) +int(18) +int(1) +int(2) +int(0) +int(20) +int(20) +int(19) +int(18) +int(1) +int(2) +int(0) +int(20) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) + +-- Iteration 8 -- +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) + +-- Iteration 9 -- +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(2) +int(1) +int(0) +int(0) +int(1) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(12) +int(11) +int(10) +int(1) +int(2) +int(0) +int(12) +int(11) +int(10) +int(9) +int(0) +int(1) +int(0) +int(11) + +-- Iteration 10 -- +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(16) +int(15) +int(14) +int(1) +int(2) +int(0) +int(16) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) + +-- Iteration 11 -- +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) + +-- Iteration 12 -- +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(3) +int(2) +int(1) +int(1) +int(2) +int(0) +int(3) +int(3) +int(2) +int(1) +int(1) +int(2) +int(0) +int(3) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) +int(13) +int(12) +int(11) +int(1) +int(2) +int(0) +int(13) + +-- Iteration 13 -- +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(3) +int(2) +int(1) +int(1) +int(2) +int(0) +int(3) +int(3) +int(2) +int(1) +int(1) +int(2) +int(0) +int(3) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) + +-- Iteration 14 -- +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) + +-- Iteration 15 -- +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) +int(11) +int(10) +int(9) +int(1) +int(2) +int(0) +int(11) + +-- Iteration 16 -- +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(14) +int(13) +int(12) +int(1) +int(2) +int(0) +int(14) +int(6) +int(5) +int(4) +int(1) +int(2) +int(0) +int(6) + +-- Iteration 17 -- +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(2) +int(1) +int(0) +int(1) +int(0) +int(0) +int(2) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +int(21) +int(20) +int(19) +int(1) +int(2) +int(0) +int(21) +int(5) +int(4) +int(3) +int(1) +int(2) +int(0) +int(5) +Done diff --git a/tests/std/strings/strcspn_variation12.phpt b/tests/std/strings/strcspn_variation12.phpt new file mode 100644 index 00000000..f01f8246 --- /dev/null +++ b/tests/std/strings/strcspn_variation12.phpt @@ -0,0 +1,2475 @@ +--TEST-- +Test strcspn() function : usage variations - with varying start and len args +--FILE-- + +--EXPECT-- +*** Testing strcspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 4 -- +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 5 -- +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(22) +int(23) +int(0) +int(0) +int(1) +int(2) +int(21) +int(22) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(22) +int(23) +int(0) +int(0) +int(1) +int(2) +int(21) +int(22) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(22) +int(23) +int(0) +int(0) +int(1) +int(2) +int(21) +int(22) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(23) +int(24) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) + +-- Iteration 6 -- +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(18) +int(19) +int(0) +int(0) +int(1) +int(2) +int(17) +int(18) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(18) +int(19) +int(0) +int(0) +int(1) +int(2) +int(17) +int(18) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +int(0) +int(1) +int(2) +int(16) +int(16) +int(0) +int(0) +int(1) +int(2) +int(15) +int(15) +int(0) +int(0) +int(1) +int(2) +int(14) +int(14) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(16) +int(16) +int(0) +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(18) +int(19) +int(0) +int(0) +int(1) +int(2) +int(17) +int(18) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(19) +int(20) +int(0) +int(0) +int(1) +int(2) +int(16) +int(16) +int(0) +int(0) +int(1) +int(2) +int(15) +int(15) +int(0) +int(0) +int(1) +int(2) +int(14) +int(14) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(16) +int(16) +int(0) + +-- Iteration 7 -- +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(11) +int(11) +int(0) +int(0) +int(1) +int(2) +int(10) +int(10) +int(0) +int(0) +int(1) +int(2) +int(9) +int(9) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(11) +int(11) +int(0) + +-- Iteration 8 -- +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) + +-- Iteration 9 -- +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) + +-- Iteration 10 -- +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(2) +int(8) +int(9) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(2) +int(8) +int(9) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(2) +int(8) +int(9) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(2) +int(8) +int(9) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(2) +int(9) +int(10) +int(0) +int(0) +int(1) +int(2) +int(8) +int(9) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) + +-- Iteration 11 -- +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(11) +int(12) +int(0) +int(0) +int(1) +int(2) +int(10) +int(11) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(12) +int(13) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +int(0) +int(1) +int(2) +int(5) +int(5) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +Done diff --git a/tests/std/strings/strcspn_variation5.phpt b/tests/std/strings/strcspn_variation5.phpt new file mode 100644 index 00000000..c9a05cf2 --- /dev/null +++ b/tests/std/strings/strcspn_variation5.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test strcspn() function : usage variations - with heredoc strings with default start and len args +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strcspn() : with heredoc strings *** + +-- Iteration with str value as "" -- +int(0) + +-- Iteration with str value as " + +" -- +int(0) + +-- Iteration with str value as "first line of heredoc string +second line of heredoc string +third line of heredocstring" -- +int(0) + +-- Iteration with str value as "hello world +hello +world +" -- +int(0) + +-- Iteration with str value as "hello123world456 +1234hello 1234" -- +int(0) + +-- Iteration with str value as "hello%0world%0hello +%0hello%0" -- +int(0) + +-- Iteration with str value as "hello%0@�world%0hello +%0hello%0" -- +int(0) +Done diff --git a/tests/std/strings/strcspn_variation6.phpt b/tests/std/strings/strcspn_variation6.phpt new file mode 100644 index 00000000..5d135d4a --- /dev/null +++ b/tests/std/strings/strcspn_variation6.phpt @@ -0,0 +1,174 @@ +--TEST-- +Test strcspn() function : usage variations - with heredoc strings, varying mask & default start and len args +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing strcspn() : with different mask strings *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(2) +int(2) +int(0) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) +int(2) + +-- Iteration 3 -- +int(86) +int(86) +int(1) +int(1) +int(86) +int(4) +int(4) +int(5) +int(5) +int(1) + +-- Iteration 4 -- +int(24) +int(24) +int(2) +int(2) +int(5) +int(24) +int(24) +int(5) +int(5) +int(5) + +-- Iteration 5 -- +int(31) +int(31) +int(2) +int(2) +int(26) +int(31) +int(31) +int(26) +int(26) +int(26) + +-- Iteration 6 -- +int(25) +int(25) +int(2) +int(2) +int(25) +int(25) +int(25) +int(25) +int(25) +int(25) + +-- Iteration 7 -- +int(27) +int(27) +int(2) +int(2) +int(27) +int(27) +int(27) +int(27) +int(27) +int(6) +Done diff --git a/tests/std/strings/strcspn_variation9.phpt b/tests/std/strings/strcspn_variation9.phpt new file mode 100644 index 00000000..0330a5e1 --- /dev/null +++ b/tests/std/strings/strcspn_variation9.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test strcspn() function : usage variations - different strings with default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strcspn() : with different str and default start and len args *** + +-- Iteration with str value "" -- +int(0) + +-- Iteration with str value "" -- +int(0) + +-- Iteration with str value " +" -- +int(0) + +-- Iteration with str value "\n" -- +int(2) + +-- Iteration with str value "hello world +hello +world +" -- +int(2) + +-- Iteration with str value "hello\tworld\nhello\nworld\n" -- +int(2) + +-- Iteration with str value "1234hello45world 123" -- +int(2) + +-- Iteration with str value "1234hello45world\t123" -- +int(2) + +-- Iteration with str value "hello%0world +" -- +int(2) + +-- Iteration with str value "hello\0world\012" -- +int(2) + +-- Iteration with str value "%0%0" -- +int(0) + +-- Iteration with str value "%0hello%0world%0" -- +int(0) + +-- Iteration with str value "%0hello\0world%0" -- +int(0) + +-- Iteration with str value "hello%0world" -- +int(2) + +-- Iteration with str value "hello%0world" -- +int(2) + +-- Iteration with str value "hello%0@ªaworld" -- +int(2) + +-- Iteration with str value "hello\0\100\xaaaworld" -- +int(2) +Done diff --git a/tests/std/strings/strings001.phpt b/tests/std/strings/strings001.phpt new file mode 100644 index 00000000..47842482 --- /dev/null +++ b/tests/std/strings/strings001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test whether strstr() and strrchr() are binary safe. +--FILE-- + +--EXPECTREGEX-- +string\(18\) \"nica\x00turska panica\" +string\(7\) \" panica\" diff --git a/tests/std/strings/strip_tags.phpt b/tests/std/strings/strip_tags.phpt new file mode 100644 index 00000000..e594e179 --- /dev/null +++ b/tests/std/strings/strip_tags.phpt @@ -0,0 +1,27 @@ +--TEST-- +strip_tags() function +--FILE-- + STUFF'); + echo "\n"; + echo strip_tags('NEAT blah ?> STUFF'); + echo "\n"; + echo strip_tags('NEAT STUFF'); + echo "\n"; + echo strip_tags('NEAT STUFF'); + echo "\n"; + echo strip_tags('NEAT STUFF'); + echo "\n"; + echo strip_tags('NEAT STUFF'); + echo "\n"; + echo strip_tags('TESTS ?!!?!?!!!?!!'); + echo "\n"; +?> +--EXPECT-- +NEAT STUFF +NEAT STUFF +NEAT STUFF +NEAT STUFF +NEAT STUFF +NEAT STUFF +TESTS ?!!?!?!!!?!! diff --git a/tests/std/strings/strip_tags_array.phpt b/tests/std/strings/strip_tags_array.phpt new file mode 100644 index 00000000..5c2e6118 --- /dev/null +++ b/tests/std/strings/strip_tags_array.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test strip_tags() function : basic functionality - with array argument +--FILE-- +foo bar
foobar

'; +var_dump(strip_tags($string)); +var_dump(strip_tags($string, ['a'])); +var_dump(strip_tags($string, ['p', 'a'])); +var_dump(strip_tags($string, [])); +var_dump(strip_tags($string, ['p' => true, 'a' => false])); +var_dump(strip_tags($string, ['p' => 'a'])); + +// Previous tests from strip_tags_variation2.phpt +var_dump(strip_tags($string, [0])); +var_dump(strip_tags($string, [1])); +var_dump(strip_tags($string, [1, 2])); +var_dump(strip_tags($string, ['color' => 'red', 'item' => 'pen'])); +echo "Done"; +?> +--EXPECT-- +string(14) "foo bar foobar" +string(30) "foo bar foobar" +string(37) "

foo bar foobar

" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(30) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +string(14) "foo bar foobar" +Done diff --git a/tests/std/strings/strip_tags_basic1.phpt b/tests/std/strings/strip_tags_basic1.phpt new file mode 100644 index 00000000..b930e585 --- /dev/null +++ b/tests/std/strings/strip_tags_basic1.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test strip_tags() function : basic functionality - with default arguments +--FILE-- +hello", + 'hello', + "", + '', + "", + '', + "<% echo hello %>", + '<% echo hello %>', + "", + '', + "hello

world

", + 'hello

world

', + "", + '' +); + + +// Calling strip_tags() with default arguments +// loop through the $string_array to test strip_tags on various inputs +$iteration = 1; +foreach($string_array as $string) +{ + echo "-- Iteration $iteration --\n"; + var_dump( strip_tags($string) ); + $iteration++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(5) "hello" +-- Iteration 2 -- +string(5) "hello" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(0) "" +-- Iteration 6 -- +string(0) "" +-- Iteration 7 -- +string(0) "" +-- Iteration 8 -- +string(0) "" +-- Iteration 9 -- +string(12) " echo hello " +-- Iteration 10 -- +string(12) " echo hello " +-- Iteration 11 -- +string(10) "helloworld" +-- Iteration 12 -- +string(10) "helloworld" +-- Iteration 13 -- +string(0) "" +-- Iteration 14 -- +string(0) "" +Done diff --git a/tests/std/strings/strip_tags_basic2.phpt b/tests/std/strings/strip_tags_basic2.phpt new file mode 100644 index 00000000..6d961bc1 --- /dev/null +++ b/tests/std/strings/strip_tags_basic2.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strip_tags() function : basic functionality - with all arguments +--FILE-- +

hello

worldOther text"; + +$allowed_tags_array=array( + "", + '', + "

", + '

', + "", + '', + "

+--EXPECT-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(33) "helloworldOther text" +-- Iteration 2 -- +string(33) "helloworldOther text" +-- Iteration 3 -- +string(27) "

hello

worldOther text" +-- Iteration 4 -- +string(27) "

hello

worldOther text" +-- Iteration 5 -- +string(44) "helloworld
Other text" +-- Iteration 6 -- +string(44) "helloworldOther text" +-- Iteration 7 -- +string(20) "helloworldOther text" +-- Iteration 8 -- +string(20) "helloworldOther text" +-- Iteration 9 -- +string(64) "

hello

worldOther text" +Done diff --git a/tests/std/strings/strip_tags_variation10.phpt b/tests/std/strings/strip_tags_variation10.phpt new file mode 100644 index 00000000..73e775a1 --- /dev/null +++ b/tests/std/strings/strip_tags_variation10.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test strip_tags() function : usage variations - single quoted strings +--FILE-- + \$ -> This represents the dollar sign', + '\t\r\v The quick brown fo\fx jumped over the lazy dog

', + 'This is a hyper text tag', + 'hello world\\t?>', + '

This is a paragraph

', + 'This is \ta text in bold letters\r\s\malong with slashes\n' +); + +$quotes = "

+--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(51) " \$ -> This represents the dollar sign" +-- Iteration 2 -- +string(63) "\t\r\v The quick brown fo\fx jumped over the lazy dog

" +-- Iteration 3 -- +string(31) "
This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

This is a paragraph

" +-- Iteration 6 -- +string(65) "This is \ta text in bold letters\r\s\malong with slashes\n" +Done diff --git a/tests/std/strings/strip_tags_variation11.phpt b/tests/std/strings/strip_tags_variation11.phpt new file mode 100644 index 00000000..eb819383 --- /dev/null +++ b/tests/std/strings/strip_tags_variation11.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strip_tags() function : obscure values within attributes +--FILE-- + world', + 'hello world', + 'hello world', + "hello world" +); + + +// Calling strip_tags() with default arguments +// loop through the $string_array to test strip_tags on various inputs +$iteration = 1; +foreach($string_array as $string) +{ + echo "-- Iteration $iteration --\n"; + var_dump( strip_tags($string) ); + $iteration++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : obscure functionality *** +-- Iteration 1 -- +string(12) "hello world" +-- Iteration 2 -- +string(12) "hello world" +-- Iteration 3 -- +string(12) "hello world" +-- Iteration 4 -- +string(12) "hello world" +Done diff --git a/tests/std/strings/strip_tags_variation2.phpt b/tests/std/strings/strip_tags_variation2.phpt new file mode 100644 index 00000000..10d112a6 --- /dev/null +++ b/tests/std/strings/strip_tags_variation2.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for 'allowable_tags' +--SKIPIF-- + +--FILE-- +hello

world

"; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//get a resource variable +$fp = fopen(__FILE__, "r"); + +//get a class +class classA{ + public function __toString(){ + return "Class A Object"; + } +} + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + try { + var_dump(strip_tags($string, $value)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } + $iterator++; +}; + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(10) "helloworld" +-- Iteration 2 -- +string(10) "helloworld" +-- Iteration 3 -- +string(10) "helloworld" +-- Iteration 4 -- +string(10) "helloworld" +-- Iteration 5 -- +string(10) "helloworld" +-- Iteration 6 -- +string(10) "helloworld" +-- Iteration 7 -- +string(10) "helloworld" +-- Iteration 8 -- +string(10) "helloworld" +-- Iteration 9 -- +string(10) "helloworld" +-- Iteration 10 -- +string(10) "helloworld" +-- Iteration 11 -- +string(10) "helloworld" +-- Iteration 12 -- +string(10) "helloworld" +-- Iteration 13 -- +string(10) "helloworld" +-- Iteration 14 -- +string(10) "helloworld" +-- Iteration 15 -- +string(10) "helloworld" +-- Iteration 16 -- +string(10) "helloworld" +-- Iteration 17 -- +string(10) "helloworld" +-- Iteration 18 -- +string(10) "helloworld" +-- Iteration 19 -- +string(10) "helloworld" +-- Iteration 20 -- +string(10) "helloworld" +-- Iteration 21 -- +strip_tags(): Argument #2 ($allowed_tags) must be of type array|string|null, resource given +Done diff --git a/tests/std/strings/strip_tags_variation4.phpt b/tests/std/strings/strip_tags_variation4.phpt new file mode 100644 index 00000000..f82be502 --- /dev/null +++ b/tests/std/strings/strip_tags_variation4.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags' +--FILE-- +hello
\t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +//valid html and php tags +$quotes = "

"; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(32) "hello world... strip_tags_test" +-- Iteration 2 -- +string(34) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(26) "I am not a valid html text" +-- Iteration 10 -- +string(26) "I am not a valid html text" +-- Iteration 11 -- +string(62) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(64) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/tests/std/strings/strip_tags_variation5.phpt b/tests/std/strings/strip_tags_variation5.phpt new file mode 100644 index 00000000..71406c28 --- /dev/null +++ b/tests/std/strings/strip_tags_variation5.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test strip_tags() function : usage variations - heredoc strings +--FILE-- +hello world +

13 < 25

+ +This is a double quoted string +EOT; + +// here doc with different whitespaces +$diff_whitespaces = <<hello\r world\t +1111\t\t != 2222\v\v + +EOT; + +// here doc with numeric values +$numeric_string = <<11 < 12. 123 >22 +

string

1111\t 0000\t = 0000\n +EOT; + +// heredoc with quote chars & slash +$quote_char_string = <<This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes +EOT; + +$res_heredoc_strings = array( + //heredoc strings + $null_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// initialize the second argument +$quotes = "
+--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(67) "hello world +13 < 25 + +This is a double quoted string" +-- Iteration 4 -- +string(44) "hello world +1111 != 2222 +" +-- Iteration 5 -- +string(56) "11 < 12. 123 >22 +string 1111 0000 = 0000 +" +-- Iteration 6 -- +string(150) "This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes " +Done diff --git a/tests/std/strings/strip_tags_variation6.phpt b/tests/std/strings/strip_tags_variation6.phpt new file mode 100644 index 00000000..be46406e --- /dev/null +++ b/tests/std/strings/strip_tags_variation6.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strip_tags() function : usage variations - binary safe checking +--FILE-- + I am html string ".chr(0)."", + " I am html string\0 ", + "I am html string", + "I am html string".decbin(65)."" +); + +//loop through the strings array to check if strip_tags() is binary safe +$iterator = 1; +foreach($strings as $value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(18) " I am html string " +-- Iteration 2 -- +string(18) " I am html string " +-- Iteration 3 -- +string(16) "I am html string" +-- Iteration 4 -- +string(23) "I am html string1000001" +Done diff --git a/tests/std/strings/strip_tags_variation7.phpt b/tests/std/strings/strip_tags_variation7.phpt new file mode 100644 index 00000000..0c00a6c1 --- /dev/null +++ b/tests/std/strings/strip_tags_variation7.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags' +--FILE-- +hello \t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +$quotes = "<%?<>"; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(43) "hello world... strip_tags_test" +-- Iteration 2 -- +string(45) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(37) "I am not a valid html text" +-- Iteration 10 -- +string(37) "I am not a valid html text" +-- Iteration 11 -- +string(73) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(75) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/tests/std/strings/strip_tags_variation8.phpt b/tests/std/strings/strip_tags_variation8.phpt new file mode 100644 index 00000000..bd98632d --- /dev/null +++ b/tests/std/strings/strip_tags_variation8.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags' +--FILE-- +hello \tworld...

strip_tags_test\v\f

"; + +$quotes = array ( + "", + '', + "", + '', + "<%?php", + '<%?php', + "<>", + '<>' +); + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($quotes as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($strings, $string_value) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(33) "hello world... strip_tags_test " +-- Iteration 2 -- +string(33) "hello world... strip_tags_test " +-- Iteration 3 -- +string(33) "hello world... strip_tags_test " +-- Iteration 4 -- +string(33) "hello world... strip_tags_test " +-- Iteration 5 -- +string(33) "hello world... strip_tags_test " +-- Iteration 6 -- +string(33) "hello world... strip_tags_test " +-- Iteration 7 -- +string(46) "hello world... strip_tags_test " +-- Iteration 8 -- +string(46) "hello world... strip_tags_test " +Done diff --git a/tests/std/strings/strip_tags_variation9.phpt b/tests/std/strings/strip_tags_variation9.phpt new file mode 100644 index 00000000..86038903 --- /dev/null +++ b/tests/std/strings/strip_tags_variation9.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test strip_tags() function : usage variations - double quoted strings +--FILE-- + \$ -> This represents the dollar sign", + "\t\r\v The quick brown fo\fx jumped over the lazy dog

", + "This is a hyper text tag", + "hello world\\t?>", + "

This is a paragraph

", + "This is \ta text in bold letters\r\s\malong with slashes\n" +); + +$quotes = "

+--EXPECT-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(50) " $ -> This represents the dollar sign" +-- Iteration 2 -- +string(59) " The quick brown fo x jumped over the lazy dog

" +-- Iteration 3 -- +string(31) "
This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

This is a paragraph

" +-- Iteration 6 -- +string(62) "This is a text in bold letters \s\malong with slashes +" +Done diff --git a/tests/std/strings/stripcslashes_basic.phpt b/tests/std/strings/stripcslashes_basic.phpt new file mode 100644 index 00000000..fecef85c --- /dev/null +++ b/tests/std/strings/stripcslashes_basic.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test stripcslashes() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing stripcslashes() : basic functionality *** +string(11) "Hello World" +string(13) "Hello World +" +string(12) "\Hello World" +string(11) "Hello World" +string(11) "Hello World" +string(2) "07" +string(2) "08" +string(2) "0c" +string(2) "09" +string(2) "0b" diff --git a/tests/std/strings/stripos.phpt b/tests/std/strings/stripos.phpt new file mode 100644 index 00000000..9af1e389 --- /dev/null +++ b/tests/std/strings/stripos.phpt @@ -0,0 +1,61 @@ +--TEST-- +stripos() function test +--SKIPIF-- + +--FILE-- + + +DONE +?> +--EXPECT-- +int(0) +int(5) +int(5) +int(3) +int(10) +int(2) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +int(0) +bool(false) +bool(false) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(1) + +DONE diff --git a/tests/std/strings/stripos_basic1.phpt b/tests/std/strings/stripos_basic1.phpt new file mode 100644 index 00000000..51e6ce2e --- /dev/null +++ b/tests/std/strings/stripos_basic1.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test stripos() function : basic functionality - with default arguments +--FILE-- + +--EXPECT-- +*** Testing stripos() function: basic functionality *** +-- With default arguments -- +int(0) +int(0) +int(7) +int(7) +int(4) +int(5) +int(0) +int(0) +int(0) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_basic2.phpt b/tests/std/strings/stripos_basic2.phpt new file mode 100644 index 00000000..02949fbb --- /dev/null +++ b/tests/std/strings/stripos_basic2.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test stripos() function : basic functionality - with all arguments +--FILE-- + +--EXPECT-- +*** Testing stripos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(7) +bool(false) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(0) +bool(false) +int(4) +int(8) +int(8) +bool(false) +int(8) +int(4) +int(4) +int(8) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_error.phpt b/tests/std/strings/stripos_error.phpt new file mode 100644 index 00000000..a3e805a7 --- /dev/null +++ b/tests/std/strings/stripos_error.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test stripos() function : error conditions +--FILE-- +getMessage() . "\n"; +} + +echo "\n-- Offset before the start of the string --\n"; +try { + stripos("Hello World", "o", -12); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing stripos() function: error conditions *** + +-- Offset beyond the end of the string -- +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) + +-- Offset before the start of the string -- +stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +*** Done *** diff --git a/tests/std/strings/stripos_variation1.phpt b/tests/std/strings/stripos_variation1.phpt new file mode 100644 index 00000000..e2d8090f --- /dev/null +++ b/tests/std/strings/stripos_variation1.phpt @@ -0,0 +1,209 @@ +--TEST-- +Test stripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--SKIPIF-- + +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls + "\0", + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "%\o", + "\o,", + "()", + "*+", + "+", + "-", + ".", + ".;", + ":;", + ";", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECT-- +*** Testing stripos() function: with double quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(34) +-- Iteration 4 -- +int(0) +int(34) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(7) +int(7) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +int(7) +int(9) +-- Iteration 11 -- +int(8) +bool(false) +-- Iteration 12 -- +int(0) +int(11) +-- Iteration 13 -- +int(0) +int(12) +-- Iteration 14 -- +int(0) +int(13) +-- Iteration 15 -- +int(10) +int(47) +-- Iteration 16 -- +int(12) +bool(false) +-- Iteration 17 -- +int(11) +bool(false) +-- Iteration 18 -- +int(13) +bool(false) +-- Iteration 19 -- +int(14) +bool(false) +-- Iteration 20 -- +int(16) +bool(false) +-- Iteration 21 -- +int(17) +bool(false) +-- Iteration 22 -- +int(20) +bool(false) +-- Iteration 23 -- +int(22) +int(22) +-- Iteration 24 -- +int(23) +int(23) +-- Iteration 25 -- +int(24) +int(24) +-- Iteration 26 -- +int(25) +int(25) +-- Iteration 27 -- +bool(false) +bool(false) +-- Iteration 28 -- +int(27) +int(27) +-- Iteration 29 -- +int(28) +int(28) +-- Iteration 30 -- +int(29) +int(29) +-- Iteration 31 -- +int(31) +int(31) +-- Iteration 32 -- +int(30) +bool(false) +-- Iteration 33 -- +int(32) +int(32) +-- Iteration 34 -- +int(33) +int(33) +-- Iteration 35 -- +int(33) +bool(false) +-- Iteration 36 -- +int(39) +int(39) +-- Iteration 37 -- +int(15) +int(48) +-- Iteration 38 -- +int(15) +int(48) +-- Iteration 39 -- +int(51) +int(51) +-- Iteration 40 -- +int(51) +int(51) +-- Iteration 41 -- +bool(false) +bool(false) +-- Iteration 42 -- +int(0) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_variation12.phpt b/tests/std/strings/stripos_variation12.phpt new file mode 100644 index 00000000..71fb0924 --- /dev/null +++ b/tests/std/strings/stripos_variation12.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Test stripos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(0) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_variation13.phpt b/tests/std/strings/stripos_variation13.phpt new file mode 100644 index 00000000..e86548ee --- /dev/null +++ b/tests/std/strings/stripos_variation13.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'needle' argument +--FILE-- + +--EXPECT-- +*** Test stripos() function: binary safe *** +int(1) +int(1) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_variation2.phpt b/tests/std/strings/stripos_variation2.phpt new file mode 100644 index 00000000..47370988 --- /dev/null +++ b/tests/std/strings/stripos_variation2.phpt @@ -0,0 +1,217 @@ +--TEST-- +Test stripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--SKIPIF-- + +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECT-- +*** Testing stripos() function: with single quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(38) +-- Iteration 4 -- +int(0) +int(38) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +int(6) +int(6) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(8) +int(8) +-- Iteration 9 -- +int(8) +int(8) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- +int(0) +int(11) +-- Iteration 13 -- +int(0) +int(12) +-- Iteration 14 -- +int(0) +int(13) +-- Iteration 15 -- +int(14) +int(14) +-- Iteration 16 -- +int(16) +int(16) +-- Iteration 17 -- +int(15) +bool(false) +-- Iteration 18 -- +int(17) +int(17) +-- Iteration 19 -- +int(18) +int(18) +-- Iteration 20 -- +int(20) +int(20) +-- Iteration 21 -- +int(21) +int(21) +-- Iteration 22 -- +int(24) +int(24) +-- Iteration 23 -- +int(26) +int(26) +-- Iteration 24 -- +int(27) +int(27) +-- Iteration 25 -- +int(28) +int(28) +-- Iteration 26 -- +int(29) +int(29) +-- Iteration 27 -- +bool(false) +bool(false) +-- Iteration 28 -- +bool(false) +bool(false) +-- Iteration 29 -- +int(31) +int(31) +-- Iteration 30 -- +int(32) +int(32) +-- Iteration 31 -- +int(33) +int(33) +-- Iteration 32 -- +int(35) +int(35) +-- Iteration 33 -- +int(34) +int(34) +-- Iteration 34 -- +int(36) +int(36) +-- Iteration 35 -- +int(37) +int(37) +-- Iteration 36 -- +int(37) +int(37) +-- Iteration 37 -- +int(43) +int(43) +-- Iteration 38 -- +int(52) +int(52) +-- Iteration 39 -- +int(19) +bool(false) +-- Iteration 40 -- +int(58) +int(58) +-- Iteration 41 -- +bool(false) +bool(false) +-- Iteration 42 -- +bool(false) +bool(false) +-- Iteration 43 -- +bool(false) +bool(false) +-- Iteration 44 -- +int(0) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripos_variation3.phpt b/tests/std/strings/stripos_variation3.phpt new file mode 100644 index 00000000..f88cda61 --- /dev/null +++ b/tests/std/strings/stripos_variation3.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test stripos() function : usage variations - multi line heredoc string for 'haystack' argument +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(14) +int(23) +int(23) +int(0) +int(7) +*** Done *** diff --git a/tests/std/strings/stripos_variation4.phpt b/tests/std/strings/stripos_variation4.phpt new file mode 100644 index 00000000..b4e4b071 --- /dev/null +++ b/tests/std/strings/stripos_variation4.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(38) +int(39) +int(55) +int(55) +int(57) +*** Done *** diff --git a/tests/std/strings/stripos_variation5.phpt b/tests/std/strings/stripos_variation5.phpt new file mode 100644 index 00000000..7368903e --- /dev/null +++ b/tests/std/strings/stripos_variation5.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(12) +int(19) +int(12) +int(19) +*** Done *** diff --git a/tests/std/strings/stripos_variation6.phpt b/tests/std/strings/stripos_variation6.phpt new file mode 100644 index 00000000..d2be564d --- /dev/null +++ b/tests/std/strings/stripos_variation6.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(34) +int(34) +int(34) +*** Done *** diff --git a/tests/std/strings/stripos_variation8.phpt b/tests/std/strings/stripos_variation8.phpt new file mode 100644 index 00000000..675e557c --- /dev/null +++ b/tests/std/strings/stripos_variation8.phpt @@ -0,0 +1,211 @@ +--TEST-- +Test stripos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing stripos() function: strings repetitive chars *** + +-- Iteration 1 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 2 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 3 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 4 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 5 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 6 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 7 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 8 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/tests/std/strings/stripslashes_basic.phpt b/tests/std/strings/stripslashes_basic.phpt new file mode 100644 index 00000000..60c4d995 --- /dev/null +++ b/tests/std/strings/stripslashes_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test stripslashes() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : basic functionality *** +string(31) "The string after addslashes is:" +string(16) "How\'s everybody" +string(33) "The string after stripslashes is:" +string(15) "How's everybody" +string(31) "The string after addslashes is:" +string(17) "Are you \"JOHN\"?" +string(33) "The string after stripslashes is:" +string(15) "Are you "JOHN"?" +string(31) "The string after addslashes is:" +string(21) "c:\\php\\stripslashes" +string(33) "The string after stripslashes is:" +string(19) "c:\php\stripslashes" +string(31) "The string after addslashes is:" +string(21) "c:\\php\\stripslashes" +string(33) "The string after stripslashes is:" +string(19) "c:\php\stripslashes" +string(31) "The string after addslashes is:" +string(12) "hello\0world" +string(33) "The string after stripslashes is:" +string(11) "hello%0world" +Done diff --git a/tests/std/strings/stripslashes_variation2.phpt b/tests/std/strings/stripslashes_variation2.phpt new file mode 100644 index 00000000..ecf6ae8a --- /dev/null +++ b/tests/std/strings/stripslashes_variation2.phpt @@ -0,0 +1,328 @@ +--TEST-- +Test stripslashes() function : usage variations - un-quote strings quoted with addslashes() +--FILE-- +', + "hello\x00world", + + // heredoc strings + $heredoc_string, + $heredoc_null_string + ); + +$count = 1; +// looping to test for all strings in $str_array +foreach( $str_array as $str ) { + echo "\n-- Iteration $count --\n"; + $str_addslashes = addslashes($str); + var_dump("The string after addslashes is:", $str_addslashes); + $str_stripslashes = stripslashes($str_addslashes); + var_dump("The string after stripslashes is:", $str_stripslashes); + if( strcmp($str, $str_stripslashes) != 0 ) + echo "\nError: Original string and string from stripslash() donot match\n"; + $count ++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing stripslashes() : with various strings containing backslashed characters *** + +-- Iteration 1 -- +string(31) "The string after addslashes is:" +string(11) "Hello world" +string(33) "The string after stripslashes is:" +string(11) "Hello world" + +-- Iteration 2 -- +string(31) "The string after addslashes is:" +string(18) "how\'re you doing?" +string(33) "The string after stripslashes is:" +string(17) "how're you doing?" + +-- Iteration 3 -- +string(31) "The string after addslashes is:" +string(30) "don\'t disturb u\'r neighbours" +string(33) "The string after stripslashes is:" +string(28) "don't disturb u'r neighbours" + +-- Iteration 4 -- +string(31) "The string after addslashes is:" +string(34) "don\'t disturb u\'r neighbours\'\'" +string(33) "The string after stripslashes is:" +string(30) "don't disturb u'r neighbours''" + +-- Iteration 5 -- +string(31) "The string after addslashes is:" +string(0) "" +string(33) "The string after stripslashes is:" +string(0) "" + +-- Iteration 6 -- +string(31) "The string after addslashes is:" +string(2) "\'" +string(33) "The string after stripslashes is:" +string(1) "'" + +-- Iteration 7 -- +string(31) "The string after addslashes is:" +string(2) "\'" +string(33) "The string after stripslashes is:" +string(1) "'" + +-- Iteration 8 -- +string(31) "The string after addslashes is:" +string(2) "\'" +string(33) "The string after stripslashes is:" +string(1) "'" + +-- Iteration 9 -- +string(31) "The string after addslashes is:" +string(32) "he said, \"he will be on leave\"" +string(33) "The string after stripslashes is:" +string(30) "he said, "he will be on leave"" + +-- Iteration 10 -- +string(31) "The string after addslashes is:" +string(34) "he said, \"\"he will be on leave\"" +string(33) "The string after stripslashes is:" +string(31) "he said, ""he will be on leave"" + +-- Iteration 11 -- +string(31) "The string after addslashes is:" +string(15) "\"\"\"PHP\"\"\"" +string(33) "The string after stripslashes is:" +string(9) """"PHP"""" + +-- Iteration 12 -- +string(31) "The string after addslashes is:" +string(0) "" +string(33) "The string after stripslashes is:" +string(0) "" + +-- Iteration 13 -- +string(31) "The string after addslashes is:" +string(2) "\"" +string(33) "The string after stripslashes is:" +string(1) """ + +-- Iteration 14 -- +string(31) "The string after addslashes is:" +string(2) "\"" +string(33) "The string after stripslashes is:" +string(1) """ + +-- Iteration 15 -- +string(31) "The string after addslashes is:" +string(7) "hello\"" +string(33) "The string after stripslashes is:" +string(6) "hello"" + +-- Iteration 16 -- +string(31) "The string after addslashes is:" +string(2) "\"" +string(33) "The string after stripslashes is:" +string(1) """ + +-- Iteration 17 -- +string(31) "The string after addslashes is:" +string(26) "Is your name Ram\\Krishna?" +string(33) "The string after stripslashes is:" +string(25) "Is your name Ram\Krishna?" + +-- Iteration 18 -- +string(31) "The string after addslashes is:" +string(9) "\\0.0.0.0" +string(33) "The string after stripslashes is:" +string(8) "\0.0.0.0" + +-- Iteration 19 -- +string(31) "The string after addslashes is:" +string(31) "c:\\php\\testcase\\stripslashes" +string(33) "The string after stripslashes is:" +string(28) "c:\php\testcase\stripslashes" + +-- Iteration 20 -- +string(31) "The string after addslashes is:" +string(2) "\\" +string(33) "The string after stripslashes is:" +string(1) "\" + +-- Iteration 21 -- +string(31) "The string after addslashes is:" +string(2) "\\" +string(33) "The string after stripslashes is:" +string(1) "\" + +-- Iteration 22 -- +string(31) "The string after addslashes is:" +string(12) "hello\0world" +string(33) "The string after stripslashes is:" +string(11) "hello%0world" + +-- Iteration 23 -- +string(31) "The string after addslashes is:" +string(9) "\0hello\0" +string(33) "The string after stripslashes is:" +string(7) "%0hello%0" + +-- Iteration 24 -- +string(31) "The string after addslashes is:" +string(9) "\0\0hello" +string(33) "The string after stripslashes is:" +string(7) "%0%0hello" + +-- Iteration 25 -- +string(31) "The string after addslashes is:" +string(2) "\0" +string(33) "The string after stripslashes is:" +string(1) "%0" + +-- Iteration 26 -- +string(31) "The string after addslashes is:" +string(13) "\'\\0.0.0.0\'" +string(33) "The string after stripslashes is:" +string(10) "'\0.0.0.0'" + +-- Iteration 27 -- +string(31) "The string after addslashes is:" +string(15) "\'\\0.0.0.0\'\0" +string(33) "The string after stripslashes is:" +string(11) "'\0.0.0.0'%0" + +-- Iteration 28 -- +string(31) "The string after addslashes is:" +string(15) "\0\'c:\\php\\\'" +string(33) "The string after stripslashes is:" +string(10) "%0'c:\php\'" + +-- Iteration 29 -- +string(31) "The string after addslashes is:" +string(13) "\"\\0.0.0.0\"" +string(33) "The string after stripslashes is:" +string(10) ""\0.0.0.0"" + +-- Iteration 30 -- +string(31) "The string after addslashes is:" +string(17) "\"c:\\php\\\"\0\'" +string(33) "The string after stripslashes is:" +string(11) ""c:\php\"%0'" + +-- Iteration 31 -- +string(31) "The string after addslashes is:" +string(22) "\"hello\"\'world\'\0//" +string(33) "The string after stripslashes is:" +string(17) ""hello"'world'%0//" + +-- Iteration 32 -- +string(31) "The string after addslashes is:" +string(18) "0xABCDEF0123456789" +string(33) "The string after stripslashes is:" +string(18) "0xABCDEF0123456789" + +-- Iteration 33 -- +string(31) "The string after addslashes is:" +string(2) "\0" +string(33) "The string after stripslashes is:" +string(1) "%0" + +-- Iteration 34 -- +string(31) "The string after addslashes is:" +string(18) "!@#$%&*@$%#&/;:,<>" +string(33) "The string after stripslashes is:" +string(18) "!@#$%&*@$%#&/;:,<>" + +-- Iteration 35 -- +string(31) "The string after addslashes is:" +string(12) "hello\0world" +string(33) "The string after stripslashes is:" +string(11) "hello%0world" + +-- Iteration 36 -- +string(31) "The string after addslashes is:" +string(73) "This is line 1 of \'heredoc\' string +This is line 2 of \"heredoc\" string" +string(33) "The string after stripslashes is:" +string(69) "This is line 1 of 'heredoc' string +This is line 2 of "heredoc" string" + +-- Iteration 37 -- +string(31) "The string after addslashes is:" +string(0) "" +string(33) "The string after stripslashes is:" +string(0) "" +Done diff --git a/tests/std/strings/stripslashes_variation3.phpt b/tests/std/strings/stripslashes_variation3.phpt new file mode 100644 index 00000000..a2e909b2 --- /dev/null +++ b/tests/std/strings/stripslashes_variation3.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test stripslashes() function : usage variations - strings with newline and tab characters +--FILE-- + +--EXPECT-- +*** Testing stripslashes() : with strings containing newline and tab characters *** + +-- Iteration 1 -- +string(1) " +" + +-- Iteration 2 -- +string(1) "n" + +-- Iteration 3 -- +string(12) "Hello +world" + +-- Iteration 4 -- +string(12) "Hello nworld" + +-- Iteration 5 -- +string(1) "n" + +-- Iteration 6 -- +string(1) "n" + +-- Iteration 7 -- +string(12) "Hello nworld" + +-- Iteration 8 -- +string(12) "Hello nworld" + +-- Iteration 9 -- +string(71) "This is line 1 +of 'heredoc' string +This is line 2 +of "heredoc" string" + +-- Iteration 10 -- +string(1) " " + +-- Iteration 11 -- +string(1) "t" + +-- Iteration 12 -- +string(12) "Hello world" + +-- Iteration 13 -- +string(12) "Hello tworld" + +-- Iteration 14 -- +string(1) "t" + +-- Iteration 15 -- +string(1) "t" + +-- Iteration 16 -- +string(12) "Hello tworld" + +-- Iteration 17 -- +string(12) "Hello tworld" + +-- Iteration 18 -- +string(71) "This is line 1 of 'heredoc' string +This is line 2 of "heredoc" string" +Done diff --git a/tests/std/strings/stripslashes_variation4.phpt b/tests/std/strings/stripslashes_variation4.phpt new file mode 100644 index 00000000..8c65d4bc --- /dev/null +++ b/tests/std/strings/stripslashes_variation4.phpt @@ -0,0 +1,132 @@ +--TEST-- +Test stripslashes() function : usage variations - double dimensional arrays +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing stripslashes() : with double dimensional arrays *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(0) { + } +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 3 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } +} + +-- Iteration 4 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 5 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } + } +} + +-- Iteration 6 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } + } +} +Done diff --git a/tests/std/strings/stristr.phpt b/tests/std/strings/stristr.phpt new file mode 100644 index 00000000..56c99bcb --- /dev/null +++ b/tests/std/strings/stristr.phpt @@ -0,0 +1,32 @@ +--TEST-- +stristr() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(11) "tEsT sTrInG" +string(6) "sTrInG" +string(6) "sTrInG" +string(8) "T sTrInG" +string(1) "G" +string(32) "7272696018bdeb2c9a3f8d01fc2a9273" +string(0) "" +string(1) "a" +bool(false) +string(32) "6ec19f52f0766c463f3bb240f4396913" +string(7) " sTrInG" diff --git a/tests/std/strings/stristr2.phpt b/tests/std/strings/stristr2.phpt new file mode 100644 index 00000000..ae2c8e93 --- /dev/null +++ b/tests/std/strings/stristr2.phpt @@ -0,0 +1,25 @@ +--TEST-- +stristr() - New parameter: before_needle +--FILE-- + +--EXPECT-- +string(7) "cCdEfGh" +string(2) "Ab" +string(5) "eEfGh" +string(4) "AbCd" +bool(false) +bool(false) diff --git a/tests/std/strings/stristr_basic.phpt b/tests/std/strings/stristr_basic.phpt new file mode 100644 index 00000000..922e11b7 --- /dev/null +++ b/tests/std/strings/stristr_basic.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test stristr() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing stristr() : basic functionality *** +string(11) "Test string" +string(6) "stRIng" +string(6) "StrinG" +string(8) "T string" +string(1) "G" +string(6) "005374" +string(4) "tEst" +string(4) "teSt" +string(6) "String" +string(5) "Test " diff --git a/tests/std/strings/stristr_variation2.phpt b/tests/std/strings/stristr_variation2.phpt new file mode 100644 index 00000000..000fd2d9 --- /dev/null +++ b/tests/std/strings/stristr_variation2.phpt @@ -0,0 +1,105 @@ +--TEST-- +Test stristr() function : usage variations - test values for $needle argument +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } + $count ++; +} + +fclose($file_handle); //closing the file handle + +?> +--EXPECT-- +*** Testing stristr() function: with unexpected inputs for 'needle' argument *** +-- 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 -- +stristr(): Argument #2 ($needle) must be of type string, array given +-- Iteration 9 -- +stristr(): Argument #2 ($needle) must be of type string, array given +-- Iteration 10 -- +stristr(): Argument #2 ($needle) must be of type string, array given +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +string(11) "Hello World" +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +string(11) "Hello World" +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +stristr(): Argument #2 ($needle) must be of type string, resource given diff --git a/tests/std/strings/strlen.phpt b/tests/std/strings/strlen.phpt new file mode 100644 index 00000000..f4d5a403 --- /dev/null +++ b/tests/std/strings/strlen.phpt @@ -0,0 +1,199 @@ +--TEST-- +strlen() function +--SKIPIF-- + +--INI-- +precision = 12 +--FILE-- +<-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\\\\ + abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\\\\ + abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\\\\ + abcdefghijklmnopqrstuvwxyz0123456789" + ); + +/* loop through to find the length of each string */ +for($i=0; $i "; + var_dump( strlen($strings[$i]) ); +} + + + +echo "\n#### Testing miscellaneous inputs ####\n"; + +echo "--- Testing objects ---\n"; +/* we get "Recoverable fatal error: saying Object of class could not be converted + to string" by default when an object is passed instead of string: +The error can be avoided by choosing the __toString magix method as follows: */ + +class StringCapable { + function __toString() { + return "Hello, world"; + } +} +$obj_string = new StringCapable; + +var_dump(strlen("$obj_string")); + + +echo "\n--- Testing arrays ---\n"; +$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!", array()); +var_dump(strlen("$str_arr[1]")); +var_dump(strlen("$str_arr[2]")); + + +echo "\n--- Testing a longer and heredoc string ---\n"; +$string = << +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +#### Basic operations and variations #### +String length of 'Hello, World' is => int(12) +String length of 'Hello, World' is => int(12) +String length of '!!Hello, World' is => int(14) +String length of '??Hello, World' is => int(14) +String length of '$@#%^&*!~,.:;?' is => int(14) +String length of '123' is => int(3) +String length of '123' is => int(3) +String length of '-1.2345' is => int(7) +String length of '-1.2344' is => int(7) +String length of '' is => int(0) +String length of ' ' is => int(1) +String length of '%0' is => int(1) +String length of '%00' is => int(2) +String length of '«C' is => int(2) +String length of '%00' is => int(2) +String length of '0' is => int(1) +String length of '0' is => int(1) +String length of ' ' is => int(1) +String length of '\t' is => int(2) +String length of '1' is => int(1) +String length of '' is => int(0) +String length of 'Hello, World%0' is => int(13) +String length of 'Hello%0World' is => int(11) +String length of 'Hello, World\0' is => int(14) +String length of 'Hello, World +' is => int(13) +String length of 'Hello, World ' is => int(13) +String length of 'Hello, World ' is => int(13) +String length of 'Hello, World\' is => int(13) +String length of ' ' is => int(14) +String length of '€êAÿ%0' is => int(5) +String length of 'abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\ + abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\ + abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+=|?><-;:$ + []{}{{{}}}[[[[]][]]]***&&&^^%$###@@!!@#$%&^&**/////|\\\ + abcdefghijklmnopqrstuvwxyz0123456789' is => int(495) + +#### Testing miscellaneous inputs #### +--- Testing objects --- +int(12) + +--- Testing arrays --- +int(6) +int(20) + +--- Testing a longer and heredoc string --- +int(639) + +--- Testing a heredoc null string --- +int(0) + +--- Testing simple and complex syntax strings --- +int(5) +int(7) + +Warning: Undefined variable $strS in %s on line %d +int(0) +int(6) +int(6) + +--- strlen for long float values --- +int(13) +int(12) + +--- Nested strlen() --- +int(1) +Done diff --git a/tests/std/strings/strlen_basic.phpt b/tests/std/strings/strlen_basic.phpt new file mode 100644 index 00000000..428d1a17 --- /dev/null +++ b/tests/std/strings/strlen_basic.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test strlen() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strlen() : basic functionality *** +int(6) +int(7) +int(0) +int(18) diff --git a/tests/std/strings/strnatcasecmp_basic.phpt b/tests/std/strings/strnatcasecmp_basic.phpt new file mode 100644 index 00000000..d1ccf4ff --- /dev/null +++ b/tests/std/strings/strnatcasecmp_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strnatcasecmp() function : basic functionality +--SKIPIF-- + +--CREDITS-- +Felix De Vliegher +--FILE-- + +--EXPECT-- +*** Testing strnatcasecmp() : basic functionality *** +int(0) +int(-1) +int(1) +int(-1) +int(1) +int(0) +int(1) +int(1) +int(-1) +int(-1) +int(0) +int(-1) +int(0) diff --git a/tests/std/strings/strnatcasecmp_variation1.phpt b/tests/std/strings/strnatcasecmp_variation1.phpt new file mode 100644 index 00000000..5ad38704 --- /dev/null +++ b/tests/std/strings/strnatcasecmp_variation1.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strnatcasecmp() function : variation +--SKIPIF-- + +--CREDITS-- +Felix De Vliegher +--FILE-- + +--EXPECT-- +*** Testing strnatcasecmp() : variation *** +int(1) +int(1) +int(-1) +int(-1) +int(0) +int(0) diff --git a/tests/std/strings/strnatcmp_basic.phpt b/tests/std/strings/strnatcmp_basic.phpt new file mode 100644 index 00000000..e7cb3586 --- /dev/null +++ b/tests/std/strings/strnatcmp_basic.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test strnatcmp() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strnatcmp() : basic functionality *** +Less than tests +int(-1) +int(-1) +int(-1) +int(-1) +int(-1) +int(1) +int(1) +int(1) +int(1) +int(1) +Equal too tests +int(0) +int(1) +Greater than tests +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) diff --git a/tests/std/strings/strnatcmp_leftalign.phpt b/tests/std/strings/strnatcmp_leftalign.phpt new file mode 100644 index 00000000..bdff3d21 --- /dev/null +++ b/tests/std/strings/strnatcmp_leftalign.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strnatcmp() function : left align, whitespace, digits +--CREDITS-- +Sol Richardson +--FILE-- + +--EXPECT-- +-- Testing strnatcmp() function whitespace, left-align, digit -- +-- Leading whitespace, digits, string 1 longer -- +int(1) +-- Leading whitespace, digits, string 2 longer -- +int(-1) diff --git a/tests/std/strings/strncasecmp_basic.phpt b/tests/std/strings/strncasecmp_basic.phpt new file mode 100644 index 00000000..39c06c45 --- /dev/null +++ b/tests/std/strings/strncasecmp_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strncasecmp() function : basic functionality +--FILE-- + 0 + +echo "-- Testing strncasecmp() with double quoted string --\n"; +var_dump( strncasecmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncasecmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncasecmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncasecmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\* +-- Testing strncasecmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncasecmp_error.phpt b/tests/std/strings/strncasecmp_error.phpt new file mode 100644 index 00000000..46bbdbe3 --- /dev/null +++ b/tests/std/strings/strncasecmp_error.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test strncasecmp() function : error conditions +--FILE-- +getMessage() . \PHP_EOL; +} + +?> +--EXPECT-- +*** Testing strncasecmp() function: error conditions *** +-- Testing strncasecmp() function with invalid argument -- +strncasecmp(): Argument #3 ($length) must be greater than or equal to 0 diff --git a/tests/std/strings/strncasecmp_variation1.phpt b/tests/std/strings/strncasecmp_variation1.phpt new file mode 100644 index 00000000..a63879be --- /dev/null +++ b/tests/std/strings/strncasecmp_variation1.phpt @@ -0,0 +1,130 @@ +--TEST-- +Test strncasecmp() function: usage variations - case-sensitivity +--FILE-- + +--EXPECT-- +*** Test strncasecmp() function: with alphabets *** +-- Passing upper-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Passing lower-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/tests/std/strings/strncasecmp_variation2.phpt b/tests/std/strings/strncasecmp_variation2.phpt new file mode 100644 index 00000000..19b56f3e --- /dev/null +++ b/tests/std/strings/strncasecmp_variation2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strncasecmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncasecmp_variation3.phpt b/tests/std/strings/strncasecmp_variation3.phpt new file mode 100644 index 00000000..c81ef24b --- /dev/null +++ b/tests/std/strings/strncasecmp_variation3.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strncasecmp() function: usage variations - various lengths +--FILE-- += 0; $len--) { + var_dump( strncasecmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECT-- +*** Test strncasecmp() function: with different lengths *** +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/tests/std/strings/strncasecmp_variation6.phpt b/tests/std/strings/strncasecmp_variation6.phpt new file mode 100644 index 00000000..3a7b9061 --- /dev/null +++ b/tests/std/strings/strncasecmp_variation6.phpt @@ -0,0 +1,802 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe - all ASCII chars +--FILE-- + +--EXPECT-- +*** Test strncasecmp() function: with binary inputs *** + +-- Checking with all 256 characters given, in binary format -- +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(0) +int(0) +-- Iteration 3 -- +int(0) +int(0) +-- Iteration 4 -- +int(0) +int(0) +-- Iteration 5 -- +int(0) +int(0) +-- Iteration 6 -- +int(0) +int(0) +-- Iteration 7 -- +int(0) +int(0) +-- Iteration 8 -- +int(0) +int(0) +-- Iteration 9 -- +int(0) +int(0) +-- Iteration 10 -- +int(0) +int(0) +-- Iteration 11 -- +int(0) +int(0) +-- Iteration 12 -- +int(0) +int(0) +-- Iteration 13 -- +int(0) +int(0) +-- Iteration 14 -- +int(0) +int(0) +-- Iteration 15 -- +int(0) +int(0) +-- Iteration 16 -- +int(0) +int(0) +-- Iteration 17 -- +int(0) +int(0) +-- Iteration 18 -- +int(0) +int(0) +-- Iteration 19 -- +int(0) +int(0) +-- Iteration 20 -- +int(0) +int(0) +-- Iteration 21 -- +int(0) +int(0) +-- Iteration 22 -- +int(0) +int(0) +-- Iteration 23 -- +int(0) +int(0) +-- Iteration 24 -- +int(0) +int(0) +-- Iteration 25 -- +int(0) +int(0) +-- Iteration 26 -- +int(0) +int(0) +-- Iteration 27 -- +int(0) +int(0) +-- Iteration 28 -- +int(0) +int(0) +-- Iteration 29 -- +int(0) +int(0) +-- Iteration 30 -- +int(0) +int(0) +-- Iteration 31 -- +int(0) +int(0) +-- Iteration 32 -- +int(0) +int(0) +-- Iteration 33 -- +int(0) +int(0) +-- Iteration 34 -- +int(0) +int(0) +-- Iteration 35 -- +int(0) +int(0) +-- Iteration 36 -- +int(0) +int(0) +-- Iteration 37 -- +int(0) +int(0) +-- Iteration 38 -- +int(0) +int(0) +-- Iteration 39 -- +int(0) +int(0) +-- Iteration 40 -- +int(0) +int(0) +-- Iteration 41 -- +int(0) +int(0) +-- Iteration 42 -- +int(0) +int(0) +-- Iteration 43 -- +int(0) +int(0) +-- Iteration 44 -- +int(0) +int(0) +-- Iteration 45 -- +int(0) +int(0) +-- Iteration 46 -- +int(0) +int(0) +-- Iteration 47 -- +int(0) +int(0) +-- Iteration 48 -- +int(0) +int(0) +-- Iteration 49 -- +int(0) +int(0) +-- Iteration 50 -- +int(0) +int(0) +-- Iteration 51 -- +int(0) +int(0) +-- Iteration 52 -- +int(0) +int(0) +-- Iteration 53 -- +int(0) +int(0) +-- Iteration 54 -- +int(0) +int(0) +-- Iteration 55 -- +int(0) +int(0) +-- Iteration 56 -- +int(0) +int(0) +-- Iteration 57 -- +int(0) +int(0) +-- Iteration 58 -- +int(0) +int(0) +-- Iteration 59 -- +int(0) +int(0) +-- Iteration 60 -- +int(0) +int(0) +-- Iteration 61 -- +int(0) +int(0) +-- Iteration 62 -- +int(0) +int(0) +-- Iteration 63 -- +int(0) +int(0) +-- Iteration 64 -- +int(0) +int(0) +-- Iteration 65 -- +int(0) +int(0) +-- Iteration 66 -- +int(0) +int(0) +-- Iteration 67 -- +int(0) +int(0) +-- Iteration 68 -- +int(0) +int(0) +-- Iteration 69 -- +int(0) +int(0) +-- Iteration 70 -- +int(0) +int(0) +-- Iteration 71 -- +int(0) +int(0) +-- Iteration 72 -- +int(0) +int(0) +-- Iteration 73 -- +int(0) +int(0) +-- Iteration 74 -- +int(0) +int(0) +-- Iteration 75 -- +int(0) +int(0) +-- Iteration 76 -- +int(0) +int(0) +-- Iteration 77 -- +int(0) +int(0) +-- Iteration 78 -- +int(0) +int(0) +-- Iteration 79 -- +int(0) +int(0) +-- Iteration 80 -- +int(0) +int(0) +-- Iteration 81 -- +int(0) +int(0) +-- Iteration 82 -- +int(0) +int(0) +-- Iteration 83 -- +int(0) +int(0) +-- Iteration 84 -- +int(0) +int(0) +-- Iteration 85 -- +int(0) +int(0) +-- Iteration 86 -- +int(0) +int(0) +-- Iteration 87 -- +int(0) +int(0) +-- Iteration 88 -- +int(0) +int(0) +-- Iteration 89 -- +int(0) +int(0) +-- Iteration 90 -- +int(0) +int(0) +-- Iteration 91 -- +int(0) +int(0) +-- Iteration 92 -- +int(0) +int(0) +-- Iteration 93 -- +int(0) +int(0) +-- Iteration 94 -- +int(0) +int(0) +-- Iteration 95 -- +int(0) +int(0) +-- Iteration 96 -- +int(0) +int(0) +-- Iteration 97 -- +int(0) +int(0) +-- Iteration 98 -- +int(0) +int(0) +-- Iteration 99 -- +int(0) +int(0) +-- Iteration 100 -- +int(0) +int(0) +-- Iteration 101 -- +int(0) +int(0) +-- Iteration 102 -- +int(0) +int(0) +-- Iteration 103 -- +int(0) +int(0) +-- Iteration 104 -- +int(0) +int(0) +-- Iteration 105 -- +int(0) +int(0) +-- Iteration 106 -- +int(0) +int(0) +-- Iteration 107 -- +int(0) +int(0) +-- Iteration 108 -- +int(0) +int(0) +-- Iteration 109 -- +int(0) +int(0) +-- Iteration 110 -- +int(0) +int(0) +-- Iteration 111 -- +int(0) +int(0) +-- Iteration 112 -- +int(0) +int(0) +-- Iteration 113 -- +int(0) +int(0) +-- Iteration 114 -- +int(0) +int(0) +-- Iteration 115 -- +int(0) +int(0) +-- Iteration 116 -- +int(0) +int(0) +-- Iteration 117 -- +int(0) +int(0) +-- Iteration 118 -- +int(0) +int(0) +-- Iteration 119 -- +int(0) +int(0) +-- Iteration 120 -- +int(0) +int(0) +-- Iteration 121 -- +int(0) +int(0) +-- Iteration 122 -- +int(0) +int(0) +-- Iteration 123 -- +int(0) +int(0) +-- Iteration 124 -- +int(0) +int(0) +-- Iteration 125 -- +int(0) +int(0) +-- Iteration 126 -- +int(0) +int(0) +-- Iteration 127 -- +int(0) +int(0) +-- Iteration 128 -- +int(0) +int(0) +-- Iteration 129 -- +int(0) +int(0) +-- Iteration 130 -- +int(0) +int(0) +-- Iteration 131 -- +int(0) +int(0) +-- Iteration 132 -- +int(0) +int(0) +-- Iteration 133 -- +int(0) +int(0) +-- Iteration 134 -- +int(0) +int(0) +-- Iteration 135 -- +int(0) +int(0) +-- Iteration 136 -- +int(0) +int(0) +-- Iteration 137 -- +int(0) +int(0) +-- Iteration 138 -- +int(0) +int(0) +-- Iteration 139 -- +int(0) +int(0) +-- Iteration 140 -- +int(0) +int(0) +-- Iteration 141 -- +int(0) +int(0) +-- Iteration 142 -- +int(0) +int(0) +-- Iteration 143 -- +int(0) +int(0) +-- Iteration 144 -- +int(0) +int(0) +-- Iteration 145 -- +int(0) +int(0) +-- Iteration 146 -- +int(0) +int(0) +-- Iteration 147 -- +int(0) +int(0) +-- Iteration 148 -- +int(0) +int(0) +-- Iteration 149 -- +int(0) +int(0) +-- Iteration 150 -- +int(0) +int(0) +-- Iteration 151 -- +int(0) +int(0) +-- Iteration 152 -- +int(0) +int(0) +-- Iteration 153 -- +int(0) +int(0) +-- Iteration 154 -- +int(0) +int(0) +-- Iteration 155 -- +int(0) +int(0) +-- Iteration 156 -- +int(0) +int(0) +-- Iteration 157 -- +int(0) +int(0) +-- Iteration 158 -- +int(0) +int(0) +-- Iteration 159 -- +int(0) +int(0) +-- Iteration 160 -- +int(0) +int(0) +-- Iteration 161 -- +int(0) +int(0) +-- Iteration 162 -- +int(0) +int(0) +-- Iteration 163 -- +int(0) +int(0) +-- Iteration 164 -- +int(0) +int(0) +-- Iteration 165 -- +int(0) +int(0) +-- Iteration 166 -- +int(0) +int(0) +-- Iteration 167 -- +int(0) +int(0) +-- Iteration 168 -- +int(0) +int(0) +-- Iteration 169 -- +int(0) +int(0) +-- Iteration 170 -- +int(0) +int(0) +-- Iteration 171 -- +int(0) +int(0) +-- Iteration 172 -- +int(0) +int(0) +-- Iteration 173 -- +int(0) +int(0) +-- Iteration 174 -- +int(0) +int(0) +-- Iteration 175 -- +int(0) +int(0) +-- Iteration 176 -- +int(0) +int(0) +-- Iteration 177 -- +int(0) +int(0) +-- Iteration 178 -- +int(0) +int(0) +-- Iteration 179 -- +int(0) +int(0) +-- Iteration 180 -- +int(0) +int(0) +-- Iteration 181 -- +int(0) +int(0) +-- Iteration 182 -- +int(0) +int(0) +-- Iteration 183 -- +int(0) +int(0) +-- Iteration 184 -- +int(0) +int(0) +-- Iteration 185 -- +int(0) +int(0) +-- Iteration 186 -- +int(0) +int(0) +-- Iteration 187 -- +int(0) +int(0) +-- Iteration 188 -- +int(0) +int(0) +-- Iteration 189 -- +int(0) +int(0) +-- Iteration 190 -- +int(0) +int(0) +-- Iteration 191 -- +int(0) +int(0) +-- Iteration 192 -- +int(0) +int(0) +-- Iteration 193 -- +int(0) +int(0) +-- Iteration 194 -- +int(0) +int(0) +-- Iteration 195 -- +int(0) +int(0) +-- Iteration 196 -- +int(0) +int(0) +-- Iteration 197 -- +int(0) +int(0) +-- Iteration 198 -- +int(0) +int(0) +-- Iteration 199 -- +int(0) +int(0) +-- Iteration 200 -- +int(0) +int(0) +-- Iteration 201 -- +int(0) +int(0) +-- Iteration 202 -- +int(0) +int(0) +-- Iteration 203 -- +int(0) +int(0) +-- Iteration 204 -- +int(0) +int(0) +-- Iteration 205 -- +int(0) +int(0) +-- Iteration 206 -- +int(0) +int(0) +-- Iteration 207 -- +int(0) +int(0) +-- Iteration 208 -- +int(0) +int(0) +-- Iteration 209 -- +int(0) +int(0) +-- Iteration 210 -- +int(0) +int(0) +-- Iteration 211 -- +int(0) +int(0) +-- Iteration 212 -- +int(0) +int(0) +-- Iteration 213 -- +int(0) +int(0) +-- Iteration 214 -- +int(0) +int(0) +-- Iteration 215 -- +int(0) +int(0) +-- Iteration 216 -- +int(0) +int(0) +-- Iteration 217 -- +int(0) +int(0) +-- Iteration 218 -- +int(0) +int(0) +-- Iteration 219 -- +int(0) +int(0) +-- Iteration 220 -- +int(0) +int(0) +-- Iteration 221 -- +int(0) +int(0) +-- Iteration 222 -- +int(0) +int(0) +-- Iteration 223 -- +int(0) +int(0) +-- Iteration 224 -- +int(0) +int(0) +-- Iteration 225 -- +int(0) +int(0) +-- Iteration 226 -- +int(0) +int(0) +-- Iteration 227 -- +int(0) +int(0) +-- Iteration 228 -- +int(0) +int(0) +-- Iteration 229 -- +int(0) +int(0) +-- Iteration 230 -- +int(0) +int(0) +-- Iteration 231 -- +int(0) +int(0) +-- Iteration 232 -- +int(0) +int(0) +-- Iteration 233 -- +int(0) +int(0) +-- Iteration 234 -- +int(0) +int(0) +-- Iteration 235 -- +int(0) +int(0) +-- Iteration 236 -- +int(0) +int(0) +-- Iteration 237 -- +int(0) +int(0) +-- Iteration 238 -- +int(0) +int(0) +-- Iteration 239 -- +int(0) +int(0) +-- Iteration 240 -- +int(0) +int(0) +-- Iteration 241 -- +int(0) +int(0) +-- Iteration 242 -- +int(0) +int(0) +-- Iteration 243 -- +int(0) +int(0) +-- Iteration 244 -- +int(0) +int(0) +-- Iteration 245 -- +int(0) +int(0) +-- Iteration 246 -- +int(0) +int(0) +-- Iteration 247 -- +int(0) +int(0) +-- Iteration 248 -- +int(0) +int(0) +-- Iteration 249 -- +int(0) +int(0) +-- Iteration 250 -- +int(0) +int(0) +-- Iteration 251 -- +int(0) +int(0) +-- Iteration 252 -- +int(0) +int(0) +-- Iteration 253 -- +int(0) +int(0) +-- Iteration 254 -- +int(0) +int(0) +-- Iteration 255 -- +int(0) +int(0) + +-- Checking with out of character's range, given in binary format -- +int(1) + +*** Done *** diff --git a/tests/std/strings/strncasecmp_variation7.phpt b/tests/std/strings/strncasecmp_variation7.phpt new file mode 100644 index 00000000..bb6be7c2 --- /dev/null +++ b/tests/std/strings/strncasecmp_variation7.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe +--FILE-- + +--EXPECT-- +*** Test strncasecmp() function: with null terminated strings and binary inputs *** +int(1) +int(-119) +*** Done *** diff --git a/tests/std/strings/strncasecmp_variation8.phpt b/tests/std/strings/strncasecmp_variation8.phpt new file mode 100644 index 00000000..b0a6f2fc --- /dev/null +++ b/tests/std/strings/strncasecmp_variation8.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strncasecmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncasecmp_variation9.phpt b/tests/std/strings/strncasecmp_variation9.phpt new file mode 100644 index 00000000..7b0c19d2 --- /dev/null +++ b/tests/std/strings/strncasecmp_variation9.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test strncasecmp() function: usage variations - heredoc strings +--FILE-- + +--EXPECT-- +*** Test strncasecmp() function: with here-doc strings *** +int(0) +int(1) +int(0) +int(1) +int(0) +int(-1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/tests/std/strings/strncmp_basic.phpt b/tests/std/strings/strncmp_basic.phpt new file mode 100644 index 00000000..f0344f4c --- /dev/null +++ b/tests/std/strings/strncmp_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strncmp() function : basic functionality +--FILE-- + 0 + +echo "-- Testing strncmp() with double quoted string --\n"; +var_dump( strncmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncmp\(\) function: basic functionality \*\*\* +-- Testing strncmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncmp_error.phpt b/tests/std/strings/strncmp_error.phpt new file mode 100644 index 00000000..ed836510 --- /dev/null +++ b/tests/std/strings/strncmp_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strncmp() function : error conditions +--FILE-- +getMessage() . \PHP_EOL; +} + +?> +--EXPECT-- +*** Testing strncmp() function: error conditions *** +strncmp(): Argument #3 ($length) must be greater than or equal to 0 diff --git a/tests/std/strings/strncmp_variation1.phpt b/tests/std/strings/strncmp_variation1.phpt new file mode 100644 index 00000000..03353b42 --- /dev/null +++ b/tests/std/strings/strncmp_variation1.phpt @@ -0,0 +1,130 @@ +--TEST-- +Test strncmp() function: usage variations - case-sensitivity +--FILE-- + 0 +} +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with alphabets \*\*\* +-- Passing upper-case letters for 'str1' -- +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) + +-- Passing lower-case letters for 'str1' -- +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncmp_variation2.phpt b/tests/std/strings/strncmp_variation2.phpt new file mode 100644 index 00000000..d871a960 --- /dev/null +++ b/tests/std/strings/strncmp_variation2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strncmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncmp_variation3.phpt b/tests/std/strings/strncmp_variation3.phpt new file mode 100644 index 00000000..6375f630 --- /dev/null +++ b/tests/std/strings/strncmp_variation3.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strncmp() function: usage variations - different lengths +--FILE-- += 0; $len--) { + var_dump( strncmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with different lengths \*\*\* +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncmp_variation7.phpt b/tests/std/strings/strncmp_variation7.phpt new file mode 100644 index 00000000..f7232613 --- /dev/null +++ b/tests/std/strings/strncmp_variation7.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test strncmp() function : usage variations - binary safe(null terminated strings) +--FILE-- + +--EXPECT-- +*** Test strncmp() function: Checking with the null terminated strings *** +int(1) +*** Done *** diff --git a/tests/std/strings/strncmp_variation8.phpt b/tests/std/strings/strncmp_variation8.phpt new file mode 100644 index 00000000..ff4864e1 --- /dev/null +++ b/tests/std/strings/strncmp_variation8.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strncmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/tests/std/strings/strncmp_variation9.phpt b/tests/std/strings/strncmp_variation9.phpt new file mode 100644 index 00000000..baa9691d --- /dev/null +++ b/tests/std/strings/strncmp_variation9.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test strncmp() function: usage variations - different inputs(heredoc strings) +--FILE-- + +--EXPECT-- +*** Test strncmp() function: with different input strings *** +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/tests/std/strings/strpbrk_basic.phpt b/tests/std/strings/strpbrk_basic.phpt new file mode 100644 index 00000000..a9a798fe --- /dev/null +++ b/tests/std/strings/strpbrk_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test strpbrk() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strpbrk() : basic functionality *** +string(20) "is is a Simple text." +string(12) "Simple text." +bool(false) +bool(false) +bool(false) +string(12) " aaa aaaSLR" +string(1) "5" +string(1) "5" diff --git a/tests/std/strings/strpbrk_error.phpt b/tests/std/strings/strpbrk_error.phpt new file mode 100644 index 00000000..3d7f84e9 --- /dev/null +++ b/tests/std/strings/strpbrk_error.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test strpbrk() function : error conditions +--FILE-- +getMessage() . "\n"; +} + +?> +--EXPECT-- +-- Testing strpbrk() function with empty second argument -- +strpbrk(): Argument #2 ($characters) must be a non-empty string diff --git a/tests/std/strings/strpos.phpt b/tests/std/strings/strpos.phpt new file mode 100644 index 00000000..b556c9fa --- /dev/null +++ b/tests/std/strings/strpos.phpt @@ -0,0 +1,289 @@ +--TEST-- +Test strpos() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + "; + var_dump( strpos($string, $needles[$i]) ); +} + + +echo "\n*** Testing strpos() with possible variations in offset ***\n"; +$offset_values = array ( + 1, // offset = 1 + "string", // offset as string, converts to zero + "", // offset as string, converts to zero + "0", + TRUE, + FALSE, + "string12", + -10, // Not found + -15, // Found + -strlen($string), +); + +/* loop through to get the "needle" position in $string */ +for( $i = 0; $i < count( $offset_values ); $i++ ) { + echo "Position of 'Hello' with offset '$offset_values[$i]' is => "; + try { + var_dump( strpos($string, "Hello", $offset_values[$i]) ); + } catch (TypeError $e) { + echo "\n", $e->getMessage(), "\n"; + } +} + + +echo "\n*** Testing miscellaneous input data ***\n"; + +echo "-- Passing objects as string and needle --\n"; +/* we get "Recoverable fatal error: saying Object of class needle could not be + converted to string" by default when an object is passed instead of string: + The error can be avoided by choosing the __toString magix method as follows: */ + +class StringCapable +{ + function __toString() { + return "Hello, world"; + } +} +$obj_string = new StringCapable; + +class needle +{ + function __toString() { + return "world"; + } +} +$obj_needle = new needle; + +var_dump( strpos("$obj_string", "$obj_needle") ); + +echo "\n-- Posiibilities with null --\n"; +var_dump( strpos("", NULL) ); +var_dump( strpos(NULL, NULL) ); +var_dump( strpos("a", NULL) ); +var_dump( strpos("/x0", "0") ); // Hexadecimal NUL + +echo "\n-- A longer and heredoc string --\n"; +$string = << "\n" in the first line +var_dump( strpos($string, "abcd", 73) ); // 73 -> "abcd" in the second line +var_dump( strpos($string, "9", (strlen($string)-1)) ); + +echo "\n-- A heredoc null string --\n"; +$str = << strlen() +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strpos($string, "test", -strlen($string)-1); // offset before start +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +?> + +DONE +?> +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +*** Testing basic functionality of strpos() *** +int(0) +int(5) +int(5) +int(3) +int(10) +int(2) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(1) + +*** Testing strpos() to find various needles and a long string *** +Position of 'Hello world' is => int(0) +Position of 'WORLD' is => bool(false) +Position of '%0' is => int(46) +Position of '%0' is => int(46) +Position of '%00' is => int(58) +Position of 'abcd' is => int(48) +Position of 'xyz' is => int(54) +Position of 'octal' is => int(61) +Position of '-3' is => int(19) +Position of '-3' is => int(19) +Position of '-3.344' is => int(19) +Position of '-3.344' is => int(19) +Position of 'NULL' is => int(31) +Position of '0' is => int(12) +Position of '0' is => int(12) +Position of '1' is => int(13) +Position of 'TRUE' is => int(36) +Position of '1' is => int(13) +Position of '1' is => int(13) +Position of '' is => int(0) +Position of 'FALSE' is => int(41) +Position of ' ' is => int(5) +Position of ' ' is => int(26) +Position of 'b' is => int(49) +Position of '\n' is => bool(false) +Position of ' +' is => int(66) +Position of '12' is => int(13) +Position of '12twelve' is => bool(false) +Position of 'Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world' is => int(0) + +*** Testing strpos() with possible variations in offset *** +Position of 'Hello' with offset '1' is => int(74) +Position of 'Hello' with offset 'string' is => +strpos(): Argument #3 ($offset) must be of type int, string given +Position of 'Hello' with offset '' is => +strpos(): Argument #3 ($offset) must be of type int, string given +Position of 'Hello' with offset '0' is => int(0) +Position of 'Hello' with offset '1' is => int(74) +Position of 'Hello' with offset '' is => int(0) +Position of 'Hello' with offset 'string12' is => +strpos(): Argument #3 ($offset) must be of type int, string given +Position of 'Hello' with offset '-10' is => bool(false) +Position of 'Hello' with offset '-15' is => int(74) +Position of 'Hello' with offset '-85' is => int(0) + +*** Testing miscellaneous input data *** +-- Passing objects as string and needle -- +int(7) + +-- Posiibilities with null -- + +Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +int(0) + +Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in %s on line %d + +Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +int(0) + +Deprecated: strpos(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +int(0) +int(2) + +-- A longer and heredoc string -- +int(0) +int(73) +int(73) +int(728) + +-- A heredoc null string -- +bool(false) +bool(false) + +-- simple and complex syntax strings -- +int(7) +int(7) + +Warning: Undefined variable $needleS in %s on line %d +int(0) +int(7) +int(7) + +*** Testing error conditions *** +int(0) +strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) + +DONE diff --git a/tests/std/strings/strpos_number.phpt b/tests/std/strings/strpos_number.phpt new file mode 100644 index 00000000..76cf8e59 --- /dev/null +++ b/tests/std/strings/strpos_number.phpt @@ -0,0 +1,15 @@ +--TEST-- +strpos() matching numbers +--FILE-- + +--EXPECT-- +int(4) +bool(false) +int(4) diff --git a/tests/std/strings/strpos_variation1.phpt b/tests/std/strings/strpos_variation1.phpt new file mode 100644 index 00000000..ce224cb7 --- /dev/null +++ b/tests/std/strings/strpos_variation1.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test strpos() function : usage variations - complex strings containing other than 7-bit chars +--SKIPIF-- + +--FILE-- + "; +var_dump( strpos($string, chr(128)) ); +echo bin2hex( chr(255) ) ." => "; +var_dump( strpos($string, chr(255), 3) ); +echo bin2hex( chr(0) ) ." => "; +var_dump( strpos($string, chr(0)) ); +?> + +DONE +?> +--EXPECT-- +-- Positions of some chars in the string '008081eaebfeff' are as follows -- +80 => int(1) +ff => int(6) +00 => int(0) + +DONE diff --git a/tests/std/strings/strrchr.phpt b/tests/std/strings/strrchr.phpt new file mode 100644 index 00000000..2af37264 --- /dev/null +++ b/tests/std/strings/strrchr.phpt @@ -0,0 +1,22 @@ +--TEST-- +strrchr() tests +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) +string(3) "abc" +string(5) " test" +string(5) "tring" +Done diff --git a/tests/std/strings/strrchr_basic.phpt b/tests/std/strings/strrchr_basic.phpt new file mode 100644 index 00000000..870742a9 --- /dev/null +++ b/tests/std/strings/strrchr_basic.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test strrchr() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: basic functionality *** +string(12) "Hello, World" +string(0) "" +string(12) "Hello, World" +string(0) "" +string(12) "Hello, World" +string(0) "" +string(12) "Hello, World" +string(0) "" +bool(false) +bool(false) +bool(false) +bool(false) +string(5) "World" +string(7) "Hello, " +string(5) "World" +string(7) "Hello, " +string(7) ", World" +string(5) "Hello" +string(7) ", World" +string(5) "Hello" +string(12) "Hello, World" +string(0) "" +string(12) "Hello, World" +string(0) "" +string(4) "orld" +string(8) "Hello, W" +string(4) "orld" +string(8) "Hello, W" +bool(false) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrchr_variation1.phpt b/tests/std/strings/strrchr_variation1.phpt new file mode 100644 index 00000000..3e71728e --- /dev/null +++ b/tests/std/strings/strrchr_variation1.phpt @@ -0,0 +1,222 @@ +--TEST-- +Test strrchr() function : usage variations - double quoted strings +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", + " ", + "\n", + "\N", + " +", //new line + + //nulls + "\0", + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "%\o", + "\o,", + "()", + "*+", + "+", + "-", + ".", + ".;", + ":;", + ";", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + 42, //needle as int(ASCII value of "*") + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrchr() function: with various double quoted strings *** +-- Iteration 1 -- +string(16) "lo123456he #4 A " + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +string(53) "Hello, +%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 4 -- +string(8) "he #4 A " + +-- Iteration 5 -- +string(47) " +%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 6 -- +string(36) "\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 7 -- +string(47) " +%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 8 -- +string(44) " + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 9 -- +string(36) "\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 10 -- +string(44) " + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 11 -- +string(45) "%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 12 -- +string(45) "%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 13 -- +string(45) "%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 14 -- +string(45) "%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 15 -- +string(1) " " + +-- Iteration 16 -- +string(41) "$&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 17 -- +string(1) " " + +-- Iteration 18 -- +string(40) "&!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 19 -- +string(39) "!#%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 20 -- +string(37) "%\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 21 -- +string(36) "\o,()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 22 -- +string(33) "()*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 23 -- +string(31) "*+-./:;<=>?@hello123456he #4 A " + +-- Iteration 24 -- +string(30) "+-./:;<=>?@hello123456he #4 A " + +-- Iteration 25 -- +string(29) "-./:;<=>?@hello123456he #4 A " + +-- Iteration 26 -- +string(28) "./:;<=>?@hello123456he #4 A " + +-- Iteration 27 -- +string(28) "./:;<=>?@hello123456he #4 A " + +-- Iteration 28 -- +string(26) ":;<=>?@hello123456he #4 A " + +-- Iteration 29 -- +string(25) ";<=>?@hello123456he #4 A " + +-- Iteration 30 -- +string(24) "<=>?@hello123456he #4 A " + +-- Iteration 31 -- +string(22) ">?@hello123456he #4 A " + +-- Iteration 32 -- +string(23) "=>?@hello123456he #4 A " + +-- Iteration 33 -- +string(21) "?@hello123456he #4 A " + +-- Iteration 34 -- +string(20) "@hello123456he #4 A " + +-- Iteration 35 -- +string(20) "@hello123456he #4 A " + +-- Iteration 36 -- +string(14) "123456he #4 A " + +-- Iteration 37 -- +string(5) "#4 A " + +-- Iteration 38 -- +string(5) "#4 A " + +-- Iteration 39 -- +string(2) "A " + +-- Iteration 40 -- +string(2) "A " + +-- Iteration 41 -- +string(4) "4 A " + +-- Iteration 42 -- +string(4) "4 A " + +-- Iteration 43 -- +string(53) "Hello, +%0 + $&!#%\o,()*+-./:;<=>?@hello123456he #4 A " +*** Done *** diff --git a/tests/std/strings/strrchr_variation12.phpt b/tests/std/strings/strrchr_variation12.phpt new file mode 100644 index 00000000..84b9eb76 --- /dev/null +++ b/tests/std/strings/strrchr_variation12.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test strrchr() function : usage variations - binary safe +--FILE-- + +--EXPECTF-- +*** Test strrchr() function: binary safe *** +string(6) "%0World" +string(6) "%0World" +string(12) "%0Hello World" +string(12) "%0Hello World" +string(1) "%0" +string(1) "%0" +string(1) "%0" +string(1) "%0" +string(6) "%0world" +string(6) "%0world" +string(6) "%0Hello" +string(6) "%0Hello" +string(1) "%0" +string(1) "%0" +*** Done *** diff --git a/tests/std/strings/strrchr_variation2.phpt b/tests/std/strings/strrchr_variation2.phpt new file mode 100644 index 00000000..646f13a7 --- /dev/null +++ b/tests/std/strings/strrchr_variation2.phpt @@ -0,0 +1,207 @@ +--TEST-- +Test strrchr() function : usage variations - single quoted strings +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECT-- +*** Testing strrchr() function: with various single quoted strings *** +-- Iteration 1 -- +string(22) "lo123456he \x234 \101 " + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 4 -- +string(14) "he \x234 \101 " + +-- Iteration 5 -- +string(5) "\101 " + +-- Iteration 6 -- +string(5) "\101 " + +-- Iteration 7 -- +string(1) " " + +-- Iteration 8 -- +string(5) "\101 " + +-- Iteration 9 -- +string(5) "\101 " + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +string(5) "\101 " + +-- Iteration 12 -- +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- +bool(false) + +-- Iteration 15 -- +string(1) " " + +-- Iteration 16 -- +string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 17 -- +string(1) " " + +-- Iteration 18 -- +string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 19 -- +string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 20 -- +string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 21 -- +string(5) "\101 " + +-- Iteration 22 -- +string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 23 -- +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 24 -- +string(36) "+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 25 -- +string(35) "-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 26 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 27 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 28 -- +string(32) ":;<=>?@hello123456he \x234 \101 " + +-- Iteration 29 -- +string(31) ";<=>?@hello123456he \x234 \101 " + +-- Iteration 30 -- +string(30) "<=>?@hello123456he \x234 \101 " + +-- Iteration 31 -- +string(28) ">?@hello123456he \x234 \101 " + +-- Iteration 32 -- +string(29) "=>?@hello123456he \x234 \101 " + +-- Iteration 33 -- +string(27) "?@hello123456he \x234 \101 " + +-- Iteration 34 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 35 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 36 -- +string(2) "1 " + +-- Iteration 37 -- +string(5) "\101 " + +-- Iteration 38 -- +string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 39 -- +string(5) "\101 " + +-- Iteration 40 -- +bool(false) + +-- Iteration 41 -- +string(7) "4 \101 " + +-- Iteration 42 -- +string(7) "4 \101 " + +-- Iteration 43 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +*** Done *** diff --git a/tests/std/strings/strrchr_variation3.phpt b/tests/std/strings/strrchr_variation3.phpt new file mode 100644 index 00000000..b536dd5b --- /dev/null +++ b/tests/std/strings/strrchr_variation3.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test strrchr() function : usage variations - multi line heredoc string for 'haystack' +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: with heredoc strings *** +string(19) "ing heredoc syntax." +bool(false) +string(8) " syntax." +string(63) "Example of string +spanning multiple lines +using heredoc syntax." +*** Done *** diff --git a/tests/std/strings/strrchr_variation4.phpt b/tests/std/strings/strrchr_variation4.phpt new file mode 100644 index 00000000..dfec9f82 --- /dev/null +++ b/tests/std/strings/strrchr_variation4.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing special chars for 'haystack' +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: with heredoc strings *** +string(24) "!$#$^^&*(special) +chars." +string(31) "_")!#@@!$#$^^&*(special) +chars." +string(16) "(special) +chars." +string(21) "$^^&*(special) +chars." +string(16) "(special) +chars." +string(19) "^&*(special) +chars." +string(76) "Example of heredoc string contains +$#%^*&*_("_")!#@@!$#$^^&*(special) +chars." +*** Done *** diff --git a/tests/std/strings/strrchr_variation5.phpt b/tests/std/strings/strrchr_variation5.phpt new file mode 100644 index 00000000..0d67fda0 --- /dev/null +++ b/tests/std/strings/strrchr_variation5.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing escape sequences for 'haystack' +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: with heredoc strings *** +string(32) " st ch using +scape \seque +ce" +string(9) "\seque +ce" +string(24) " using +scape \seque +ce" +string(9) "\seque +ce" +string(32) " st ch using +scape \seque +ce" +*** Done *** diff --git a/tests/std/strings/strrchr_variation6.phpt b/tests/std/strings/strrchr_variation6.phpt new file mode 100644 index 00000000..cec657c6 --- /dev/null +++ b/tests/std/strings/strrchr_variation6.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing quote chars for 'haystack' +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: with heredoc strings *** +string(3) "te'" +string(32) "" +'things' 'in' 'single' 'quote'" +bool(false) +string(14) "ingle' 'quote'" +string(6) "quote'" +string(32) "" +'things' 'in' 'single' 'quote'" +*** Done *** diff --git a/tests/std/strings/strrchr_variation7.phpt b/tests/std/strings/strrchr_variation7.phpt new file mode 100644 index 00000000..f27c4749 --- /dev/null +++ b/tests/std/strings/strrchr_variation7.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing blank line for 'haystack' +--FILE-- + +--EXPECT-- +*** Testing strrchr() function: with heredoc strings *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrev.phpt b/tests/std/strings/strrev.phpt new file mode 100644 index 00000000..15cf248f --- /dev/null +++ b/tests/std/strings/strrev.phpt @@ -0,0 +1,17 @@ +--TEST-- +strrev() function +--FILE-- + +--EXPECT-- +string(32) "ec6df70f2569891eae50321a9179eb82" +string(0) "" diff --git a/tests/std/strings/strrev_basic.phpt b/tests/std/strings/strrev_basic.phpt new file mode 100644 index 00000000..357ae514 --- /dev/null +++ b/tests/std/strings/strrev_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test strrev() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strrev() : basic functionality *** +string(12) "dlroW ,olleH" +string(12) "dlroW ,olleH" +string(1) "H" +string(1) "H" +string(6) "HHHHHH" +string(6) "HhhhhH" +string(13) " +dlroW ,olleH" +string(14) "n\dlroW ,olleH" +string(12) "dlrow ,olleH" +*** Done *** diff --git a/tests/std/strings/strrev_variation1.phpt b/tests/std/strings/strrev_variation1.phpt new file mode 100644 index 00000000..3c4fb79a --- /dev/null +++ b/tests/std/strings/strrev_variation1.phpt @@ -0,0 +1,152 @@ +--TEST-- +Test strrev() function : usage variations - double quoted strings +--FILE-- + +--EXPECTF-- +*** Testing strrev() : with various double quoted strings *** + +-- Iteration 1 -- +string(11) "dlrow\olleh" + +-- Iteration 2 -- +string(11) "dlrow$olleh" + +-- Iteration 3 -- +string(23) "verrts gnitset gnitset " + +-- Iteration 4 -- +string(29) "verrts gnitset verrts gnitset" + +-- Iteration 5 -- +string(32) "verrts + gnitset verrts gnitset" + +-- Iteration 6 -- +string(33) "verrts + gnitset +verrts +gnitset +" + +-- Iteration 7 -- +string(18) "bat lacitrev gnisu" + +-- Iteration 8 -- +string(10) "HelloolleH" + +-- Iteration 9 -- +string(13) "ababababababa" + +-- Iteration 10 -- +string(8) "321olleH" + +-- Iteration 11 -- +string(8) "olleH321" + +-- Iteration 12 -- +string(11) "olleH43.321" + +-- Iteration 13 -- +string(10) "432.1olleH" + +-- Iteration 14 -- +string(13) "432.1olleH321" + +-- Iteration 15 -- +string(11) "dlroW%0olleH" + +-- Iteration 16 -- +string(10) "dlrowolleH" + +-- Iteration 17 -- +string(10) "iiiiHolleH" + +-- Iteration 18 -- +string(15) "h " + +-- Iteration 19 -- +string(15) " h" + +-- Iteration 20 -- +string(15) " h " + +-- Iteration 21 -- +string(15) " o l l e h" + +-- Iteration 22 -- +string(13) "dlrow'\olleh\" + +-- Iteration 23 -- +string(11) "dlrow"olleh" + +-- Iteration 24 -- +string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t" + +-- Iteration 25 -- +string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!" + +-- Iteration 26 -- +string(26) "/uu/ u\ verrts\tse r/tset/" + +-- Iteration 27 -- +string(16) "~`-=+_)(*&^%$#@!" +*** Done *** diff --git a/tests/std/strings/strrev_variation2.phpt b/tests/std/strings/strrev_variation2.phpt new file mode 100644 index 00000000..45036f6f --- /dev/null +++ b/tests/std/strings/strrev_variation2.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test strrev() function : usage variations - single quoted strings +--FILE-- + +--EXPECTF-- +*** Testing strrev() : with various single quoted strings *** + +-- Iteration 1 -- +string(11) "dlrow\olleh" + +-- Iteration 2 -- +string(12) "dlrow$\olleh" + +-- Iteration 3 -- +string(26) "verrtst\gnitsett\gnitsett\" + +-- Iteration 4 -- +string(30) "verrts gnitset verrtsr\gnitset" + +-- Iteration 5 -- +string(35) "verrtsn\ gnitset f\ verrtsf\gnitset" + +-- Iteration 6 -- +string(37) "verrts n\ gnitset n\verrtsn\gnitsetn\" + +-- Iteration 7 -- +string(20) "batv\lacitrevv\gnisu" + +-- Iteration 8 -- +string(10) "HelloolleH" + +-- Iteration 9 -- +string(13) "ababababababa" + +-- Iteration 10 -- +string(8) "321olleH" + +-- Iteration 11 -- +string(8) "olleH321" + +-- Iteration 12 -- +string(11) "olleH43.321" + +-- Iteration 13 -- +string(10) "432.1olleH" + +-- Iteration 14 -- +string(13) "432.1olleH321" + +-- Iteration 15 -- +string(11) "dlroW%0olleH" + +-- Iteration 16 -- +string(10) "dlrowolleH" + +-- Iteration 17 -- +string(10) "iiiiHolleH" + +-- Iteration 18 -- +string(15) "h " + +-- Iteration 19 -- +string(15) " h" + +-- Iteration 20 -- +string(15) " h " + +-- Iteration 21 -- +string(15) " o l l e h" + +-- Iteration 22 -- +string(12) "dlrow'olleh\" + +-- Iteration 23 -- +string(12) "dlrow"\olleh" + +-- Iteration 24 -- +string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t" + +-- Iteration 25 -- +string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!" + +-- Iteration 26 -- +string(28) "/uu/ u\t\verrts\tset\r/tset/" + +-- Iteration 27 -- +string(16) "~`-=+_)(*&^%$#@!" +*** Done *** diff --git a/tests/std/strings/strrev_variation3.phpt b/tests/std/strings/strrev_variation3.phpt new file mode 100644 index 00000000..eab673f9 --- /dev/null +++ b/tests/std/strings/strrev_variation3.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test strrev() function : usage variations - heredoc strings +--FILE-- + +--EXPECTF-- +*** Testing strrev() function: with heredoc strings *** + +-- Iteration 1 -- +string(63) ".xatnys codereh gnisu +senil elpitlum gninnaps +gnirts fo elpmaxE" + +-- Iteration 2 -- +string(72) ".srahc +)laiceps(*&^^$#$!@@#!)"_"(_*&*^%#$ +sniatnoc ,g'ts cod'h fo elp'xE" + +-- Iteration 3 -- +string(25) "dlroW%0olleH + +dlroW ,olleH" + +-- Iteration 4 -- +string(94) "shsals\htiw/ si enil\siht +'etouq elgnis ni sgniht' +"etouq elbuod ni sgniht" +edis'o thgirb s'ti" + +-- Iteration 5 -- +string(0) "" + +-- Iteration 6 -- +string(0) "" +*** Done *** diff --git a/tests/std/strings/strripos.phpt b/tests/std/strings/strripos.phpt new file mode 100644 index 00000000..81881c37 --- /dev/null +++ b/tests/std/strings/strripos.phpt @@ -0,0 +1,32 @@ +--TEST-- +strripos() function +--FILE-- + +--EXPECT-- +int(5) +int(12) +int(18) +int(12) +int(10) +int(2) +int(0) +int(0) +bool(false) +int(0) +int(1) +bool(false) +int(1) diff --git a/tests/std/strings/strripos_basic1.phpt b/tests/std/strings/strripos_basic1.phpt new file mode 100644 index 00000000..06e503af --- /dev/null +++ b/tests/std/strings/strripos_basic1.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test strripos() function : basic functionality - with default arguments +--FILE-- + +--EXPECT-- +*** Testing strripos() function: basic functionality *** + +-- regular string for haystack & needle -- +int(0) +int(0) +int(7) +int(7) +bool(false) + +-- single char for needle -- +int(8) +int(5) + +-- heredoc string for haystack & needle -- +int(0) +int(0) +int(0) diff --git a/tests/std/strings/strripos_basic2.phpt b/tests/std/strings/strripos_basic2.phpt new file mode 100644 index 00000000..18625fb7 --- /dev/null +++ b/tests/std/strings/strripos_basic2.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strripos() function : basic functionality - with all arguments +--FILE-- + +--EXPECT-- +*** Testing strripos() function: basic functionality *** + +-- regular string for haystack & needle, with various offsets -- +int(0) +bool(false) +int(7) +int(7) + +-- heredoc string for haystack & needle, with various offsets -- +int(0) +int(0) +bool(false) +int(0) +bool(false) + +-- various +ve offsets -- +int(8) +int(8) +bool(false) + +-- various -ve offsets -- +int(8) +int(4) +bool(false) diff --git a/tests/std/strings/strripos_offset.phpt b/tests/std/strings/strripos_offset.phpt new file mode 100644 index 00000000..59b5374c --- /dev/null +++ b/tests/std/strings/strripos_offset.phpt @@ -0,0 +1,44 @@ +--TEST-- +strripos() offset integer overflow +--FILE-- +getMessage(), "\n"; +} + +try { + strripos(1024, 1024, -PHP_INT_MAX); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strripos(1024, "te", -PHP_INT_MAX); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strripos(1024, 1024, -PHP_INT_MAX-1); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strripos(1024, "te", -PHP_INT_MAX-1); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "Done\n"; +?> +--EXPECT-- +strripos(): Argument #3 ($offset) must be of type int, float given +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +Done diff --git a/tests/std/strings/strripos_variation1.phpt b/tests/std/strings/strripos_variation1.phpt new file mode 100644 index 00000000..57ae8dd1 --- /dev/null +++ b/tests/std/strings/strripos_variation1.phpt @@ -0,0 +1,235 @@ +--TEST-- +Test strripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needles = array( + //regular strings +/*1*/ "l", + "L", + "HELLO", + "hEllo", + + //escape characters +/*5*/ "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls +/*11*/ "\0", + + //boolean false +/*14*/ FALSE, + false, + + //empty string +/*16*/ "", + + //special chars +/*17*/ " ", + "$", + " $", + "&", + "!#", + "()", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + +/*29*/ "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +foreach ($needles as $needle) { + echo "-- Iteration $count --\n"; + var_dump( strripos($haystack, $needle) ); + var_dump( strripos($haystack, $needle, 1) ); + var_dump( strripos($haystack, $needle, 20) ); + var_dump( strripos($haystack, $needle, -1) ); + $count++; +} +?> +--EXPECT-- +*** Testing strripos() function: with double quoted strings *** +-- Iteration 1 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 2 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 3 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 4 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 5 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +int(9) +int(9) +bool(false) +int(9) +-- Iteration 9 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 10 -- +int(9) +int(9) +bool(false) +int(9) +-- Iteration 11 -- +int(8) +int(8) +bool(false) +int(8) +-- Iteration 12 -- +int(44) +int(44) +int(44) +int(43) +-- Iteration 13 -- +int(44) +int(44) +int(44) +int(43) +-- Iteration 14 -- +int(44) +int(44) +int(44) +int(43) +-- Iteration 15 -- +int(43) +int(43) +int(43) +int(43) +-- Iteration 16 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 17 -- +int(11) +int(11) +bool(false) +int(11) +-- Iteration 18 -- +int(13) +int(13) +bool(false) +int(13) +-- Iteration 19 -- +int(14) +int(14) +bool(false) +int(14) +-- Iteration 20 -- +int(17) +int(17) +bool(false) +int(17) +-- Iteration 21 -- +int(20) +int(20) +int(20) +int(20) +-- Iteration 22 -- +int(22) +int(22) +int(22) +int(22) +-- Iteration 23 -- +int(21) +int(21) +int(21) +int(21) +-- Iteration 24 -- +int(23) +int(23) +int(23) +int(23) +-- Iteration 25 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 26 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 27 -- +int(30) +int(30) +int(30) +int(30) +-- Iteration 28 -- +int(39) +int(39) +int(39) +int(39) +-- Iteration 29 -- +int(39) +int(39) +int(39) +int(39) +-- Iteration 30 -- +int(42) +int(42) +int(42) +int(42) +-- Iteration 31 -- +int(42) +int(42) +int(42) +int(42) +-- Iteration 32 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 33 -- +int(0) +bool(false) +bool(false) +int(0) diff --git a/tests/std/strings/strripos_variation2.phpt b/tests/std/strings/strripos_variation2.phpt new file mode 100644 index 00000000..12bcc2d2 --- /dev/null +++ b/tests/std/strings/strripos_variation2.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test strripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needles = array( + //regular strings +/*1*/ 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters +/*5*/ '\t', + '\T', + ' ', + '\n', + '\N', + ' + ', //new line + + //nulls +/*11*/ '\0', + + //boolean false +/*14*/ FALSE, + false, + + //empty string +/*16*/ '', + + //special chars +/*17*/ ' ', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + +/*29*/ '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //respective ASCII char of \x23 + '\101', //octal numeric string + 'A', // respective ASCII char for \101 + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +foreach ($needles as $needle) { + echo "-- Iteration $count --\n"; + var_dump( strripos($haystack, $needle) ); + var_dump( strripos($haystack, $needle, 1) ); + var_dump( strripos($haystack, $needle, 20) ); + var_dump( strripos($haystack, $needle, -1) ); + $count++; +} +?> +--EXPECT-- +*** Testing strripos() function: with single quoted strings *** +-- Iteration 1 -- +int(32) +int(32) +int(32) +int(32) +-- Iteration 2 -- +int(32) +int(32) +int(32) +int(32) +-- Iteration 3 -- +int(29) +int(29) +int(29) +int(29) +-- Iteration 4 -- +int(29) +int(29) +int(29) +int(29) +-- Iteration 5 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 6 -- +int(6) +int(6) +bool(false) +int(6) +-- Iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 8 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 9 -- +int(12) +int(12) +bool(false) +int(12) +-- Iteration 10 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +bool(false) +int(10) +-- Iteration 12 -- +int(54) +int(54) +int(54) +int(53) +-- Iteration 13 -- +int(54) +int(54) +int(54) +int(53) +-- Iteration 14 -- +int(54) +int(54) +int(54) +int(53) +-- Iteration 15 -- +int(53) +int(53) +int(53) +int(53) +-- Iteration 16 -- +int(16) +int(16) +bool(false) +int(16) +-- Iteration 17 -- +int(15) +int(15) +bool(false) +int(15) +-- Iteration 18 -- +int(17) +int(17) +bool(false) +int(17) +-- Iteration 19 -- +int(18) +int(18) +bool(false) +int(18) +-- Iteration 20 -- +int(21) +int(21) +int(21) +int(21) +-- Iteration 21 -- +int(24) +int(24) +int(24) +int(24) +-- Iteration 22 -- +int(26) +int(26) +int(26) +int(26) +-- Iteration 23 -- +int(25) +int(25) +int(25) +int(25) +-- Iteration 24 -- +int(27) +int(27) +int(27) +int(27) +-- Iteration 25 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 26 -- +int(28) +int(28) +int(28) +int(28) +-- Iteration 27 -- +int(34) +int(34) +int(34) +int(34) +-- Iteration 28 -- +int(43) +int(43) +int(43) +int(43) +-- Iteration 29 -- +int(19) +int(19) +bool(false) +int(19) +-- Iteration 30 -- +int(49) +int(49) +int(49) +int(49) +-- Iteration 31 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 32 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 33 -- +bool(false) +bool(false) +bool(false) +bool(false) +-- Iteration 34 -- +int(0) +bool(false) +bool(false) +int(0) diff --git a/tests/std/strings/strripos_variation3.phpt b/tests/std/strings/strripos_variation3.phpt new file mode 100644 index 00000000..df61842a --- /dev/null +++ b/tests/std/strings/strripos_variation3.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strripos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- + +-- Multi line strings with +ve offsets -- +int(44) +int(44) +int(44) + +-- Multi line strings with +ve offsets -- +int(44) +int(44) +bool(false) + +-- Multi line strings with no offset -- +int(18) +int(31) +int(63) +int(55) diff --git a/tests/std/strings/strripos_variation4.phpt b/tests/std/strings/strripos_variation4.phpt new file mode 100644 index 00000000..bd27fd95 --- /dev/null +++ b/tests/std/strings/strripos_variation4.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strripos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(41) +int(39) +int(55) +int(55) +int(57) diff --git a/tests/std/strings/strripos_variation5.phpt b/tests/std/strings/strripos_variation5.phpt new file mode 100644 index 00000000..40bb331f --- /dev/null +++ b/tests/std/strings/strripos_variation5.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strripos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(13) +int(19) +int(13) +int(19) diff --git a/tests/std/strings/strripos_variation6.phpt b/tests/std/strings/strripos_variation6.phpt new file mode 100644 index 00000000..11fa9544 --- /dev/null +++ b/tests/std/strings/strripos_variation6.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test strrpos() function : usage variations - negative offset with empty needle +--SKIPIF-- + +--FILE-- +?@hello123456he \x234 \101 "; + +var_dump(strlen($haystack)); + +var_dump( strripos($haystack, "", -1) ); +var_dump( strripos($haystack, "", -10) ); +var_dump( strripos($haystack, "", -26) ); +var_dump( strripos($haystack, "", -44) ); +?> + +DONE +?> +--EXPECT-- +int(44) +int(43) +int(34) +int(18) +int(0) + +DONE diff --git a/tests/std/strings/strrpos.phpt b/tests/std/strings/strrpos.phpt new file mode 100644 index 00000000..fc9d49b3 --- /dev/null +++ b/tests/std/strings/strrpos.phpt @@ -0,0 +1,36 @@ +--TEST-- +strrpos() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(5) +int(5) +int(18) +int(12) +int(10) +int(2) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +bool(false) +int(1) diff --git a/tests/std/strings/strrpos_basic1.phpt b/tests/std/strings/strrpos_basic1.phpt new file mode 100644 index 00000000..f5ab1a37 --- /dev/null +++ b/tests/std/strings/strrpos_basic1.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strrpos() function : basic functionality - with default arguments +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: basic functionality *** +-- With default arguments -- +int(0) +bool(false) +int(7) +bool(false) +int(8) +int(5) +int(0) +int(0) +int(0) +*** Done *** diff --git a/tests/std/strings/strrpos_basic2.phpt b/tests/std/strings/strrpos_basic2.phpt new file mode 100644 index 00000000..9d84a761 --- /dev/null +++ b/tests/std/strings/strrpos_basic2.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strrpos() function : basic functionality - with all arguments +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(8) +int(8) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrpos_negative_offset.phpt b/tests/std/strings/strrpos_negative_offset.phpt new file mode 100644 index 00000000..e4ac469b --- /dev/null +++ b/tests/std/strings/strrpos_negative_offset.phpt @@ -0,0 +1,42 @@ +--TEST-- +strr[i]pos() function with negative offset +--FILE-- +getMessage() . "\n"; + } + var_dump(strripos("HAYSTHACk", 'ha', -9)); + var_dump(strripos("HAYSTACK", 'h', -8)); + var_dump(strripos("HAYSTACK", 'k', -1)); + var_dump(strripos("HAYSTACK", "ka", -1)); + var_dump(strripos("HAYSTACK", 'a', -3)); + var_dump(strripos("HAYSTACK", 'a', -4)); + try { + strripos("HAYSTACK", 'h', -9); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } +?> +--EXPECT-- +int(0) +int(0) +int(7) +bool(false) +int(5) +int(1) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +int(0) +int(0) +int(7) +bool(false) +int(5) +int(1) +strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) diff --git a/tests/std/strings/strrpos_offset.phpt b/tests/std/strings/strrpos_offset.phpt new file mode 100644 index 00000000..4ec4b819 --- /dev/null +++ b/tests/std/strings/strrpos_offset.phpt @@ -0,0 +1,48 @@ +--TEST-- +strrpos() offset integer overflow +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +try { + strrpos(1024, 1024, -PHP_INT_MAX); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strrpos(1024, "te", -PHP_INT_MAX); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strrpos(1024, 1024, -PHP_INT_MAX-1); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + strrpos(1024, "te", -PHP_INT_MAX-1); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "Done\n"; +?> +--EXPECT-- +strrpos(): Argument #3 ($offset) must be of type int, float given +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +Done diff --git a/tests/std/strings/strrpos_variation12.phpt b/tests/std/strings/strrpos_variation12.phpt new file mode 100644 index 00000000..28a68339 --- /dev/null +++ b/tests/std/strings/strrpos_variation12.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test strrpos() function : usage variations - checking binary safe with 'haystack' argument +--FILE-- + +--EXPECT-- +*** Test strrpos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(2) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrpos_variation13.phpt b/tests/std/strings/strrpos_variation13.phpt new file mode 100644 index 00000000..e5757ae7 --- /dev/null +++ b/tests/std/strings/strrpos_variation13.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test strrpos() function : usage variations - checking bianry safe with 'needle' argument +--FILE-- + +--EXPECT-- +*** Test strrpos() function: binary safe *** +int(1) +int(1) +int(0) +bool(false) +int(12) +int(12) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrpos_variation14.phpt b/tests/std/strings/strrpos_variation14.phpt new file mode 100644 index 00000000..15ac4d0b --- /dev/null +++ b/tests/std/strings/strrpos_variation14.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test strrpos() function : usage variations - negative offset with empty needle +--SKIPIF-- + +--FILE-- +?@hello123456he \x234 \101 "; + +var_dump(strlen($haystack)); + +var_dump( strrpos($haystack, "", -1) ); +var_dump( strrpos($haystack, "", -10) ); +var_dump( strrpos($haystack, "", -26) ); +var_dump( strrpos($haystack, "", -44) ); +?> + +DONE +?> +--EXPECT-- +int(44) +int(43) +int(34) +int(18) +int(0) + +DONE diff --git a/tests/std/strings/strrpos_variation2.phpt b/tests/std/strings/strrpos_variation2.phpt new file mode 100644 index 00000000..48c64158 --- /dev/null +++ b/tests/std/strings/strrpos_variation2.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test strrpos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--SKIPIF-- + +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECT-- +*** Testing strrpos() function: with single quoted strings *** +-- Iteration 1 -- +int(32) +int(32) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(12) +int(12) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- +int(54) +int(54) +-- Iteration 13 -- +int(54) +int(54) +-- Iteration 14 -- +int(54) +int(54) +-- Iteration 15 -- +int(53) +int(53) +-- Iteration 16 -- +int(16) +int(16) +-- Iteration 17 -- +int(15) +bool(false) +-- Iteration 18 -- +int(17) +int(17) +-- Iteration 19 -- +int(18) +int(18) +-- Iteration 20 -- +int(21) +int(21) +-- Iteration 21 -- +int(24) +int(24) +-- Iteration 22 -- +int(26) +int(26) +-- Iteration 23 -- +int(25) +int(25) +-- Iteration 24 -- +int(27) +int(27) +-- Iteration 25 -- +int(28) +int(28) +-- Iteration 26 -- +bool(false) +bool(false) +-- Iteration 27 -- +int(34) +int(34) +-- Iteration 28 -- +int(43) +int(43) +-- Iteration 29 -- +int(19) +bool(false) +-- Iteration 30 -- +int(49) +int(49) +-- Iteration 31 -- +bool(false) +bool(false) +-- Iteration 32 -- +bool(false) +bool(false) +-- Iteration 33 -- +bool(false) +bool(false) +-- Iteration 34 -- +int(0) +bool(false) +*** Done *** diff --git a/tests/std/strings/strrpos_variation3.phpt b/tests/std/strings/strrpos_variation3.phpt new file mode 100644 index 00000000..4142d087 --- /dev/null +++ b/tests/std/strings/strrpos_variation3.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strrpos() function : usage variations - multi line heredoc string for 'haystack' argument +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(44) +int(44) +int(44) +int(63) +int(55) +*** Done *** diff --git a/tests/std/strings/strrpos_variation4.phpt b/tests/std/strings/strrpos_variation4.phpt new file mode 100644 index 00000000..494be992 --- /dev/null +++ b/tests/std/strings/strrpos_variation4.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(41) +int(39) +int(55) +int(55) +int(57) +*** Done *** diff --git a/tests/std/strings/strrpos_variation5.phpt b/tests/std/strings/strrpos_variation5.phpt new file mode 100644 index 00000000..a08c3ea2 --- /dev/null +++ b/tests/std/strings/strrpos_variation5.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(13) +int(19) +int(13) +int(19) +*** Done *** diff --git a/tests/std/strings/strrpos_variation6.phpt b/tests/std/strings/strrpos_variation6.phpt new file mode 100644 index 00000000..be501b26 --- /dev/null +++ b/tests/std/strings/strrpos_variation6.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(59) +int(59) +int(59) +*** Done *** diff --git a/tests/std/strings/strrpos_variation7.phpt b/tests/std/strings/strrpos_variation7.phpt new file mode 100644 index 00000000..a3ef9d29 --- /dev/null +++ b/tests/std/strings/strrpos_variation7.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test strrpos() function : usage variations - empty heredoc string for 'haystack' argument +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +var_dump( strrpos($empty_string, FALSE) ); + +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strrpos() function: with heredoc strings *** +-- With empty heredoc string -- +int(0) +strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +int(0) +*** Done *** diff --git a/tests/std/strings/strrpos_variation8.phpt b/tests/std/strings/strrpos_variation8.phpt new file mode 100644 index 00000000..d16ec929 --- /dev/null +++ b/tests/std/strings/strrpos_variation8.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strrpos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECT-- +*** Testing strrpos() function: strings repetitive chars *** +-- Iteration 1 -- +int(4) +-- Iteration 2 -- +int(4) +-- Iteration 3 -- +int(4) +-- Iteration 4 -- +int(4) +-- Iteration 5 -- +int(4) +-- Iteration 6 -- +int(4) +-- 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) +*** Done *** diff --git a/tests/std/strings/strspn.phpt b/tests/std/strings/strspn.phpt new file mode 100644 index 00000000..9f498b84 --- /dev/null +++ b/tests/std/strings/strspn.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test strspn() behavior +--FILE-- + +--EXPECT-- +string(25) "22222222aaaa bbb1111 cccc" +string(4) "1234" +int(8) +int(6) +int(3) diff --git a/tests/std/strings/strspn_basic.phpt b/tests/std/strings/strspn_basic.phpt new file mode 100644 index 00000000..6d48812c --- /dev/null +++ b/tests/std/strings/strspn_basic.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strspn() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strspn() : basic functionality *** +int(11) +int(11) +int(2) +Done diff --git a/tests/std/strings/strspn_variation10.phpt b/tests/std/strings/strspn_variation10.phpt new file mode 100644 index 00000000..c6452abd --- /dev/null +++ b/tests/std/strings/strspn_variation10.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test strspn() function : usage variations - with varying mask & default start and len args +--FILE-- + +--EXPECT-- +*** Testing strspn() : with different mask strings and default start and len arguments *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(1) +int(2) +int(0) +int(1) +int(1) +int(1) +int(0) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) +Done diff --git a/tests/std/strings/strspn_variation11.phpt b/tests/std/strings/strspn_variation11.phpt new file mode 100644 index 00000000..6e4fcac3 --- /dev/null +++ b/tests/std/strings/strspn_variation11.phpt @@ -0,0 +1,1299 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and default len args +--FILE-- + +--EXPECT-- +*** Testing strspn() : with different start and default len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(2) +int(1) +int(0) +int(1) +int(2) +int(0) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(1) +int(2) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +int(0) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +int(0) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +int(0) +int(4) +Done diff --git a/tests/std/strings/strspn_variation12.phpt b/tests/std/strings/strspn_variation12.phpt new file mode 100644 index 00000000..94ecbeec --- /dev/null +++ b/tests/std/strings/strspn_variation12.phpt @@ -0,0 +1,2871 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and len args +--FILE-- + +--EXPECT-- +*** Testing strspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +Done diff --git a/tests/std/strings/strspn_variation5.phpt b/tests/std/strings/strspn_variation5.phpt new file mode 100644 index 00000000..cf16801f --- /dev/null +++ b/tests/std/strings/strspn_variation5.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings with default start and len args +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with heredoc strings *** + +-- Iteration with str value as "" -- +int(0) + +-- Iteration with str value as " + +" -- +int(2) + +-- Iteration with str value as "first line of heredoc string +second line of heredoc string +third line of heredocstring" -- +int(1) + +-- Iteration with str value as "hello world +hello +world +" -- +int(5) + +-- Iteration with str value as "hello123world456 +1234hello 1234" -- +int(8) + +-- Iteration with str value as "hello%0world%0hello +%0hello%0" -- +int(6) + +-- Iteration with str value as "hello%0@�world%0hello +%0hello%0" -- +int(8) +Done diff --git a/tests/std/strings/strspn_variation6.phpt b/tests/std/strings/strspn_variation6.phpt new file mode 100644 index 00000000..f6539b81 --- /dev/null +++ b/tests/std/strings/strspn_variation6.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying mask & default start and len args +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing strspn() : with different mask strings *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(8) +int(11) +int(0) +int(0) +int(0) +int(1) +int(0) +int(2) + +-- Iteration 4 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(1) +int(0) +int(4) +Done diff --git a/tests/std/strings/strspn_variation9.phpt b/tests/std/strings/strspn_variation9.phpt new file mode 100644 index 00000000..24a62324 --- /dev/null +++ b/tests/std/strings/strspn_variation9.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test strspn() function : usage variations - different strings with default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different str and default start and len args *** + +-- Iteration with str value "" -- +int(0) + +-- Iteration with str value "" -- +int(0) + +-- Iteration with str value " +" -- +int(1) + +-- Iteration with str value "\n" -- +int(0) + +-- Iteration with str value "hello world +hello +world +" -- +int(5) + +-- Iteration with str value "hello\tworld\nhello\nworld\n" -- +int(5) + +-- Iteration with str value "1234hello45world 123" -- +int(16) + +-- Iteration with str value "1234hello45world\t123" -- +int(16) + +-- Iteration with str value "hello%0world +" -- +int(12) + +-- Iteration with str value "hello\0world\012" -- +int(5) + +-- Iteration with str value "%0%0" -- +int(2) + +-- Iteration with str value "%0hello%0world%0" -- +int(13) + +-- Iteration with str value "%0hello\0world%0" -- +int(6) + +-- Iteration with str value "hello%0world" -- +int(11) + +-- Iteration with str value "hello%0world" -- +int(11) + +-- Iteration with str value "hello%0@ªaworld" -- +int(8) + +-- Iteration with str value "hello\0\100\xaaaworld" -- +int(5) +Done diff --git a/tests/std/strings/strstr.phpt b/tests/std/strings/strstr.phpt new file mode 100644 index 00000000..fdee1c66 --- /dev/null +++ b/tests/std/strings/strstr.phpt @@ -0,0 +1,363 @@ +--TEST-- +Test strstr() function +--SKIPIF-- + +--FILE-- + expected + +?> + +DONE +?> +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +*** Testing basic functionality of strstr() *** +string(11) "test string" +string(6) "string" +string(6) "string" +string(8) "t string" +string(1) "g" +string(32) "7272696018bdeb2c9a3f8d01fc2a9273" +bool(false) +bool(false) +string(0) "" +string(1) "a" +bool(false) + +*** Testing strstr() with various needles *** +-- Iteration 0 -- +string(85) "Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +string(39) "%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 3 -- +string(39) "%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 4 -- +string(27) "%00 octal + +abcd$:Hello world" + +-- Iteration 5 -- +string(37) "abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 6 -- +string(31) "xyz %00 octal + +abcd$:Hello world" + +-- Iteration 7 -- +string(24) "octal + +abcd$:Hello world" + +-- Iteration 8 -- +string(66) "-3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 9 -- +string(66) "-3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 10 -- +string(66) "-3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 11 -- +string(66) "-3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 12 -- +string(54) "NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 13 -- +string(73) "012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 14 -- +string(73) "012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 15 -- +string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 16 -- +string(49) "TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 17 -- +string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 18 -- +string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 19 -- +string(85) "Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 20 -- +string(44) "FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 21 -- +string(80) " world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 22 -- +string(59) " NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 23 -- +string(36) "bcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 24 -- +bool(false) + +-- Iteration 25 -- +string(19) " + +abcd$:Hello world" + +-- Iteration 26 -- +string(72) "12033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +-- Iteration 27 -- +bool(false) + +-- Iteration 28 -- +string(85) "Hello world,012033 -3.3445 NULL TRUE FALSE%0 abcd\xxyz %00 octal + +abcd$:Hello world" + +*** Testing miscellaneous input data *** +-- Passing objects as string and needle -- +string(5) "world" + +-- Posiibilities with null -- + +Deprecated: strstr(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +string(0) "" + +Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in %s on line %d + +Deprecated: strstr(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +string(0) "" + +Deprecated: strstr(): Passing null to parameter #2 ($needle) of type string is deprecated in %s on line %d +string(1) "a" +string(1) "0" + +-- A longer and heredoc string -- +string(729) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" +string(702) "123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" + +-- A heredoc null string -- +bool(false) +bool(false) + +-- simple and complex syntax strings -- +string(5) "world" +string(7) "world'S" + +Warning: Undefined variable $needleS in %s on line %d +string(13) "Hello, worldS" +string(6) "worldS" +string(6) "worldS" + +*** Testing error conditions ***string(729) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" +bool(false) + +DONE diff --git a/tests/std/strings/strstr2.phpt b/tests/std/strings/strstr2.phpt new file mode 100644 index 00000000..fadeb10c --- /dev/null +++ b/tests/std/strings/strstr2.phpt @@ -0,0 +1,40 @@ +--TEST-- +strstr() - New parameter: before_needle +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +string(12) "@example.com" +string(1) "a" +string(2) "@e" +string(10) "asdfasdfas" +string(1) "@" +string(0) "" +string(5) "eE@fF" +string(0) "" +string(4) "E@fF" +string(1) "e" +bool(false) diff --git a/tests/std/strings/strstr_variation1.phpt b/tests/std/strings/strstr_variation1.phpt new file mode 100644 index 00000000..d07ac27d --- /dev/null +++ b/tests/std/strings/strstr_variation1.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test strstr() function : usage variations - complex strings containing other than 7-bit chars +--SKIPIF-- + +--FILE-- + "; +var_dump( bin2hex( strstr($string, chr(128) ) ) ); +echo bin2hex( chr(255) ) ." => "; +var_dump( bin2hex( strstr($string, chr(255) ) ) ); +echo bin2hex( chr(0) ) ." => "; +var_dump( bin2hex( strstr($string, chr(0) ) ) ); +?> + +DONE +?> +--EXPECT-- +-- Positions of some chars in the string '008081eaebfeff' are as follows -- +80 => string(12) "8081eaebfeff" +ff => string(2) "ff" +00 => string(14) "008081eaebfeff" + +DONE diff --git a/tests/std/strings/strtok_basic.phpt b/tests/std/strings/strtok_basic.phpt new file mode 100644 index 00000000..102e0d03 --- /dev/null +++ b/tests/std/strings/strtok_basic.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strtok() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strtok() : basic functionality *** + +The Input string is: +"This testcase test strtok() function." + +The token string is: +" ()." + +--- Token 1 --- +string(4) "This" + +--- Token 2 --- +string(8) "testcase" + +--- Token 3 --- +string(4) "test" + +--- Token 4 --- +string(6) "strtok" + +--- Token 5 --- +string(8) "function" + +--- Token 6 --- +bool(false) + +--- Token 7 --- +bool(false) +Done diff --git a/tests/std/strings/strtok_variation3.phpt b/tests/std/strings/strtok_variation3.phpt new file mode 100644 index 00000000..93927d9c --- /dev/null +++ b/tests/std/strings/strtok_variation3.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strtok() function : usage variations - with heredoc strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with heredoc strings *** + +--- Iteration 1 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 3 --- +string(11) "first line " +string(7) "f hered" +string(8) "c string" +string(3) "sec" +string(8) "nd line " +string(7) "f hered" +string(8) "c string" +string(11) "third line " +string(7) "f hered" +string(7) "cstring" +bool(false) + +--- Iteration 4 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(1) "w" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(4) "hell" +string(4) "123w" +string(4) "rld4" +string(1) "6" +string(8) "1234hell" +string(4) "1234" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(4) "hell" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) +Done diff --git a/tests/std/strings/strtok_variation4.phpt b/tests/std/strings/strtok_variation4.phpt new file mode 100644 index 00000000..81054f8e --- /dev/null +++ b/tests/std/strings/strtok_variation4.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test strtok() function : usage variations - with embedded nulls in the strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with embedded nulls in the strings *** + +--- Iteration 1 --- +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 2 --- +string(2) "\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(3) "hel" +string(2) "lo" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(11) "hello world" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 7 --- +string(4) "\0he" +string(5) "llo\0" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +string(9) "hello\0\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/tests/std/strings/strtok_variation5.phpt b/tests/std/strings/strtok_variation5.phpt new file mode 100644 index 00000000..1771c74a --- /dev/null +++ b/tests/std/strings/strtok_variation5.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strtok() function : usage variations - miscellaneous inputs +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with miscellaneous inputs *** + +--- Iteration 1 --- +string(11) "HELLO WORLD" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 3 --- +string(5) "HELLO" +string(5) "WORLD" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(5) "hello" +string(3) "wor" +string(2) "ld" +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(3) "hel" +string(2) "lo" +string(5) "world" +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(3) "one" +string(1) "$" +string(3) "two" +string(1) "!" +string(5) "three" +string(1) "#" + +--- Iteration 7 --- +string(11) "hello/r/wor" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 9 --- +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +--- Iteration 10 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 11 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/tests/std/strings/strtok_variation6.phpt b/tests/std/strings/strtok_variation6.phpt new file mode 100644 index 00000000..9d5440d8 --- /dev/null +++ b/tests/std/strings/strtok_variation6.phpt @@ -0,0 +1,167 @@ +--TEST-- +Test strtok() function : usage variations - invalid escape sequences as tokens +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with invalid escape sequences in token *** + +--- Iteration 1 --- +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(7) "khellok" +string(6) "worldk" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(1) " " +string(1) "r" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + + +--- Iteration 2 --- +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(9) "\khello\k" +string(7) "world\k" +bool(false) +bool(false) + +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +string(1) " " +string(1) "r" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + + +--- Iteration 3 --- +string(1) "/" +string(6) "hello\" +string(7) " world/" +bool(false) + +string(8) "khello\k" +string(5) "world" +string(1) "k" +bool(false) + +string(6) "hello\" +string(6) " world" +bool(false) + +Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d +bool(false) + +string(1) "/" +string(5) "hello" +string(7) " world/" +bool(false) + +string(1) "/" +string(1) " " +string(1) "r" +string(1) "/" + + +--- Iteration 4 --- +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(6) "hellok" +string(5) "world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(1) "/" +string(2) "/ " +string(1) "r" +bool(false) + +Done diff --git a/tests/std/strings/strtok_variation7.phpt b/tests/std/strings/strtok_variation7.phpt new file mode 100644 index 00000000..07eb3ea0 --- /dev/null +++ b/tests/std/strings/strtok_variation7.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test strtok() function : usage variations - modifying the input string while tokenising +--FILE-- + +--EXPECT-- +*** Testing strtok() : with modification of input string in between tokenising *** + +*** Testing strtok() when string being tokenised is prefixed with another string in between the process *** +string(4) "this" + +-- Token 1 is -- +string(2) "is" + +-- Input str is "extra string this is a sample string" -- + +-- Token 2 is -- +string(1) "a" + +-- Input str is "extra string this is a sample string" -- + +-- Token 3 is -- +string(6) "sample" + +-- Input str is "extra string this is a sample string" -- + +-- Token 4 is -- +string(6) "string" + +-- Input str is "extra string this is a sample string" -- + +-- Token 5 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +-- Token 6 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +*** Testing strtok() when string being tokenised is suffixed with another string in between the process *** +string(5) "extra" + +-- Token 1 is -- +string(6) "string" + +-- Token 2 is -- +string(4) "this" + +-- Token 3 is -- +string(2) "is" + +-- Token 4 is -- +string(1) "a" + +-- Token 5 is -- +string(6) "sample" + +-- Token 6 is -- +string(6) "string" + +-- Token 7 is -- +bool(false) + +-- Token 8 is -- +bool(false) + +-- Token 9 is -- +bool(false) + +-- Token 10 is -- +bool(false) +Done diff --git a/tests/std/strings/strtolower.phpt b/tests/std/strings/strtolower.phpt new file mode 100644 index 00000000..1abe45a8 --- /dev/null +++ b/tests/std/strings/strtolower.phpt @@ -0,0 +1,356 @@ +--TEST-- +Test strtolower() function +--FILE-- + ".(bin2hex(strtolower("$char")))."\n"; +} + +echo "*** Testing strlower() with basic strings ***\n"; +$str = "Mary Had A liTTle LAmb and ShE loveD IT So\n"; +var_dump(strtolower($str)); + +echo "\n*** Testing strtolower() with various strings ***"; +/* strings to pass strtolower() */ +$strings = array ( + "", + "string", + "stRINg0234", + "1.233.344StrinG12333", + "$$$$$$!!!!@@@@@@@ ABCDEF !!!***", + "ABCD\0abcdABCD", + TRUE, + FALSE, + + /* Check for off-by-one errors in the SSE implementation */ + "AAAAAAAAAAAAAAAAAAAA", + "ZZZZZZZZZZZZZZZZZZZZ", + "@@@@@@@@@@@@@@@@@@@@", + "[[[[[[[[[[[[[[[[[[[[", + "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +); + +$count = 0; +/* loop through to check possible variations */ +foreach ($strings as $string) { + echo "\n-- Iteration $count --\n"; + var_dump( strtolower($string) ); + $count++; +} + +echo "\n*** Testing strtolower() with two different case strings ***\n"; +if (strtolower("HeLLo woRLd") === strtolower("hEllo WORLD")) + echo "strings are same, with Case Insensitive\n"; +else + echo "strings are not same\n"; + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtolower() with 256 chars *** +00 => 00 +01 => 01 +02 => 02 +03 => 03 +04 => 04 +05 => 05 +06 => 06 +07 => 07 +08 => 08 +09 => 09 +0a => 0a +0b => 0b +0c => 0c +0d => 0d +0e => 0e +0f => 0f +10 => 10 +11 => 11 +12 => 12 +13 => 13 +14 => 14 +15 => 15 +16 => 16 +17 => 17 +18 => 18 +19 => 19 +1a => 1a +1b => 1b +1c => 1c +1d => 1d +1e => 1e +1f => 1f +20 => 20 +21 => 21 +22 => 22 +23 => 23 +24 => 24 +25 => 25 +26 => 26 +27 => 27 +28 => 28 +29 => 29 +2a => 2a +2b => 2b +2c => 2c +2d => 2d +2e => 2e +2f => 2f +30 => 30 +31 => 31 +32 => 32 +33 => 33 +34 => 34 +35 => 35 +36 => 36 +37 => 37 +38 => 38 +39 => 39 +3a => 3a +3b => 3b +3c => 3c +3d => 3d +3e => 3e +3f => 3f +40 => 40 +41 => 61 +42 => 62 +43 => 63 +44 => 64 +45 => 65 +46 => 66 +47 => 67 +48 => 68 +49 => 69 +4a => 6a +4b => 6b +4c => 6c +4d => 6d +4e => 6e +4f => 6f +50 => 70 +51 => 71 +52 => 72 +53 => 73 +54 => 74 +55 => 75 +56 => 76 +57 => 77 +58 => 78 +59 => 79 +5a => 7a +5b => 5b +5c => 5c +5d => 5d +5e => 5e +5f => 5f +60 => 60 +61 => 61 +62 => 62 +63 => 63 +64 => 64 +65 => 65 +66 => 66 +67 => 67 +68 => 68 +69 => 69 +6a => 6a +6b => 6b +6c => 6c +6d => 6d +6e => 6e +6f => 6f +70 => 70 +71 => 71 +72 => 72 +73 => 73 +74 => 74 +75 => 75 +76 => 76 +77 => 77 +78 => 78 +79 => 79 +7a => 7a +7b => 7b +7c => 7c +7d => 7d +7e => 7e +7f => 7f +80 => 80 +81 => 81 +82 => 82 +83 => 83 +84 => 84 +85 => 85 +86 => 86 +87 => 87 +88 => 88 +89 => 89 +8a => 8a +8b => 8b +8c => 8c +8d => 8d +8e => 8e +8f => 8f +90 => 90 +91 => 91 +92 => 92 +93 => 93 +94 => 94 +95 => 95 +96 => 96 +97 => 97 +98 => 98 +99 => 99 +9a => 9a +9b => 9b +9c => 9c +9d => 9d +9e => 9e +9f => 9f +a0 => a0 +a1 => a1 +a2 => a2 +a3 => a3 +a4 => a4 +a5 => a5 +a6 => a6 +a7 => a7 +a8 => a8 +a9 => a9 +aa => aa +ab => ab +ac => ac +ad => ad +ae => ae +af => af +b0 => b0 +b1 => b1 +b2 => b2 +b3 => b3 +b4 => b4 +b5 => b5 +b6 => b6 +b7 => b7 +b8 => b8 +b9 => b9 +ba => ba +bb => bb +bc => bc +bd => bd +be => be +bf => bf +c0 => c0 +c1 => c1 +c2 => c2 +c3 => c3 +c4 => c4 +c5 => c5 +c6 => c6 +c7 => c7 +c8 => c8 +c9 => c9 +ca => ca +cb => cb +cc => cc +cd => cd +ce => ce +cf => cf +d0 => d0 +d1 => d1 +d2 => d2 +d3 => d3 +d4 => d4 +d5 => d5 +d6 => d6 +d7 => d7 +d8 => d8 +d9 => d9 +da => da +db => db +dc => dc +dd => dd +de => de +df => df +e0 => e0 +e1 => e1 +e2 => e2 +e3 => e3 +e4 => e4 +e5 => e5 +e6 => e6 +e7 => e7 +e8 => e8 +e9 => e9 +ea => ea +eb => eb +ec => ec +ed => ed +ee => ee +ef => ef +f0 => f0 +f1 => f1 +f2 => f2 +f3 => f3 +f4 => f4 +f5 => f5 +f6 => f6 +f7 => f7 +f8 => f8 +f9 => f9 +fa => fa +fb => fb +fc => fc +fd => fd +fe => fe +ff => ff +*** Testing strlower() with basic strings *** +string(43) "mary had a little lamb and she loved it so +" + +*** Testing strtolower() with various strings *** +-- Iteration 0 -- +string(0) "" + +-- Iteration 1 -- +string(6) "string" + +-- Iteration 2 -- +string(10) "string0234" + +-- Iteration 3 -- +string(20) "1.233.344string12333" + +-- Iteration 4 -- +string(31) "$$$$$$!!!!@@@@@@@ abcdef !!!***" + +-- Iteration 5 -- +string(13) "abcd%0abcdabcd" + +-- Iteration 6 -- +string(1) "1" + +-- Iteration 7 -- +string(0) "" + +-- Iteration 8 -- +string(20) "aaaaaaaaaaaaaaaaaaaa" + +-- Iteration 9 -- +string(20) "zzzzzzzzzzzzzzzzzzzz" + +-- Iteration 10 -- +string(20) "@@@@@@@@@@@@@@@@@@@@" + +-- Iteration 11 -- +string(20) "[[[[[[[[[[[[[[[[[[[[" + +-- Iteration 12 -- +string(62) "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz" + +*** Testing strtolower() with two different case strings *** +strings are same, with Case Insensitive +*** Done *** diff --git a/tests/std/strings/strtoupper1.phpt b/tests/std/strings/strtoupper1.phpt new file mode 100644 index 00000000..220906a5 --- /dev/null +++ b/tests/std/strings/strtoupper1.phpt @@ -0,0 +1,372 @@ +--TEST-- +Test strtoupper() function +--FILE-- + ".(bin2hex(strtoupper("$char")))."\n"; +} + +echo "\n*** Testing strtoupper() with basic strings ***\n"; +$str = "Mary Had A liTTle LAmb and ShE loveD IT So\n"; +var_dump(strtoupper($str)); + +echo "\n*** Testing strtoupper() with various strings ***"; +/* strings to pass strtoupper() */ +$strings = array ( + "", + "string", + "stRINg0234", + "1.233.344StrinG12333", + "$$$$$$!!!!@@@@@@@ ABCDEF !!!***", + "ABCD\0abcdABCD", + TRUE, + FALSE, + /* Check for off-by-one errors in the SSE implementation */ + "aaaaaaaaaaaaaaaaaaaa", + "zzzzzzzzzzzzzzzzzzzz", + "````````````````````", + "{{{{{{{{{{{{{{{{{{{{", + /* And the AVX2 implementation also */ + "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{", + "abcdefghijklmnopqrstuvwxyz01234", + "abcdefghijklmnopqrstuvwxyz012345", + "abcdefghijklmnopqrstuvwxyz0123456", + "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +); + +$count = 0; +/* loop through to check possible variations */ +foreach ($strings as $string) { + echo "\n-- Iteration $count --\n"; + var_dump( strtoupper($string) ); + $count++; +} + +echo "\n*** Testing strtoupper() with two different case strings ***\n"; +if (strtoupper("HeLLo woRLd") === strtoupper("hEllo WORLD")) + echo "strings are same, with Case Insensitive\n"; +else + echo "strings are not same\n"; + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtoupper() with 256 chars *** +00 => 00 +01 => 01 +02 => 02 +03 => 03 +04 => 04 +05 => 05 +06 => 06 +07 => 07 +08 => 08 +09 => 09 +0a => 0a +0b => 0b +0c => 0c +0d => 0d +0e => 0e +0f => 0f +10 => 10 +11 => 11 +12 => 12 +13 => 13 +14 => 14 +15 => 15 +16 => 16 +17 => 17 +18 => 18 +19 => 19 +1a => 1a +1b => 1b +1c => 1c +1d => 1d +1e => 1e +1f => 1f +20 => 20 +21 => 21 +22 => 22 +23 => 23 +24 => 24 +25 => 25 +26 => 26 +27 => 27 +28 => 28 +29 => 29 +2a => 2a +2b => 2b +2c => 2c +2d => 2d +2e => 2e +2f => 2f +30 => 30 +31 => 31 +32 => 32 +33 => 33 +34 => 34 +35 => 35 +36 => 36 +37 => 37 +38 => 38 +39 => 39 +3a => 3a +3b => 3b +3c => 3c +3d => 3d +3e => 3e +3f => 3f +40 => 40 +41 => 41 +42 => 42 +43 => 43 +44 => 44 +45 => 45 +46 => 46 +47 => 47 +48 => 48 +49 => 49 +4a => 4a +4b => 4b +4c => 4c +4d => 4d +4e => 4e +4f => 4f +50 => 50 +51 => 51 +52 => 52 +53 => 53 +54 => 54 +55 => 55 +56 => 56 +57 => 57 +58 => 58 +59 => 59 +5a => 5a +5b => 5b +5c => 5c +5d => 5d +5e => 5e +5f => 5f +60 => 60 +61 => 41 +62 => 42 +63 => 43 +64 => 44 +65 => 45 +66 => 46 +67 => 47 +68 => 48 +69 => 49 +6a => 4a +6b => 4b +6c => 4c +6d => 4d +6e => 4e +6f => 4f +70 => 50 +71 => 51 +72 => 52 +73 => 53 +74 => 54 +75 => 55 +76 => 56 +77 => 57 +78 => 58 +79 => 59 +7a => 5a +7b => 7b +7c => 7c +7d => 7d +7e => 7e +7f => 7f +80 => 80 +81 => 81 +82 => 82 +83 => 83 +84 => 84 +85 => 85 +86 => 86 +87 => 87 +88 => 88 +89 => 89 +8a => 8a +8b => 8b +8c => 8c +8d => 8d +8e => 8e +8f => 8f +90 => 90 +91 => 91 +92 => 92 +93 => 93 +94 => 94 +95 => 95 +96 => 96 +97 => 97 +98 => 98 +99 => 99 +9a => 9a +9b => 9b +9c => 9c +9d => 9d +9e => 9e +9f => 9f +a0 => a0 +a1 => a1 +a2 => a2 +a3 => a3 +a4 => a4 +a5 => a5 +a6 => a6 +a7 => a7 +a8 => a8 +a9 => a9 +aa => aa +ab => ab +ac => ac +ad => ad +ae => ae +af => af +b0 => b0 +b1 => b1 +b2 => b2 +b3 => b3 +b4 => b4 +b5 => b5 +b6 => b6 +b7 => b7 +b8 => b8 +b9 => b9 +ba => ba +bb => bb +bc => bc +bd => bd +be => be +bf => bf +c0 => c0 +c1 => c1 +c2 => c2 +c3 => c3 +c4 => c4 +c5 => c5 +c6 => c6 +c7 => c7 +c8 => c8 +c9 => c9 +ca => ca +cb => cb +cc => cc +cd => cd +ce => ce +cf => cf +d0 => d0 +d1 => d1 +d2 => d2 +d3 => d3 +d4 => d4 +d5 => d5 +d6 => d6 +d7 => d7 +d8 => d8 +d9 => d9 +da => da +db => db +dc => dc +dd => dd +de => de +df => df +e0 => e0 +e1 => e1 +e2 => e2 +e3 => e3 +e4 => e4 +e5 => e5 +e6 => e6 +e7 => e7 +e8 => e8 +e9 => e9 +ea => ea +eb => eb +ec => ec +ed => ed +ee => ee +ef => ef +f0 => f0 +f1 => f1 +f2 => f2 +f3 => f3 +f4 => f4 +f5 => f5 +f6 => f6 +f7 => f7 +f8 => f8 +f9 => f9 +fa => fa +fb => fb +fc => fc +fd => fd +fe => fe +ff => ff + +*** Testing strtoupper() with basic strings *** +string(43) "MARY HAD A LITTLE LAMB AND SHE LOVED IT SO +" + +*** Testing strtoupper() with various strings *** +-- Iteration 0 -- +string(0) "" + +-- Iteration 1 -- +string(6) "STRING" + +-- Iteration 2 -- +string(10) "STRING0234" + +-- Iteration 3 -- +string(20) "1.233.344STRING12333" + +-- Iteration 4 -- +string(31) "$$$$$$!!!!@@@@@@@ ABCDEF !!!***" + +-- Iteration 5 -- +string(13) "ABCD%0ABCDABCD" + +-- Iteration 6 -- +string(1) "1" + +-- Iteration 7 -- +string(0) "" + +-- Iteration 8 -- +string(20) "AAAAAAAAAAAAAAAAAAAA" + +-- Iteration 9 -- +string(20) "ZZZZZZZZZZZZZZZZZZZZ" + +-- Iteration 10 -- +string(20) "````````````````````" + +-- Iteration 11 -- +string(20) "{{{{{{{{{{{{{{{{{{{{" + +-- Iteration 12 -- +string(40) "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{" + +-- Iteration 13 -- +string(31) "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234" + +-- Iteration 14 -- +string(32) "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" + +-- Iteration 15 -- +string(33) "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456" + +-- Iteration 16 -- +string(62) "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +*** Testing strtoupper() with two different case strings *** +strings are same, with Case Insensitive +*** Done *** diff --git a/tests/std/strings/strtr.phpt b/tests/std/strings/strtr.phpt new file mode 100644 index 00000000..1dc1e9c4 --- /dev/null +++ b/tests/std/strings/strtr.phpt @@ -0,0 +1,9 @@ +--TEST-- +strtr() function +--FILE-- +"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); +var_dump(strtr("# hi all, I said hello world! #", $trans)); +?> +--EXPECT-- +string(32) "# hello All, I sAid hi planet! #" diff --git a/tests/std/strings/strtr_basic.phpt b/tests/std/strings/strtr_basic.phpt new file mode 100644 index 00000000..7ec9e697 --- /dev/null +++ b/tests/std/strings/strtr_basic.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strtr() function : basic functionality +--FILE-- + "T", "e" => "E", "st" => "ST"); +$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST'); +$heredoc_str = << +--EXPECT-- +*** Testing strtr() : basic functionality *** +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +*** Done *** diff --git a/tests/std/strings/strtr_empty_search_string.phpt b/tests/std/strings/strtr_empty_search_string.phpt new file mode 100644 index 00000000..1cea4564 --- /dev/null +++ b/tests/std/strings/strtr_empty_search_string.phpt @@ -0,0 +1,19 @@ +--TEST-- +strtr() trying to replace an empty string +--SKIPIF-- + +--FILE-- + "bar"])); +var_dump(strtr("foo", ["" => "bar", "x" => "y"])); + +?> +--EXPECTF-- +Warning: strtr(): Ignoring replacement of empty string in %s on line %d +string(3) "foo" + +Warning: strtr(): Ignoring replacement of empty string in %s on line %d +string(3) "foo" diff --git a/tests/std/strings/strtr_variation1.phpt b/tests/std/strings/strtr_variation1.phpt new file mode 100644 index 00000000..f52e14b6 --- /dev/null +++ b/tests/std/strings/strtr_variation1.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test strtr() function : usage variations - regular & numeric strings for 'str' argument +--FILE-- + "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the $str_arr element in $str variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strtr() : numeric & regular double quoted strings *** +-- Iteration 1 -- +string(3) "abc" +string(3) "a23" +-- Iteration 2 -- +string(3) "123" +string(3) "1bc" +-- Iteration 3 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 4 -- +string(3) "abc" +string(3) "a23" +-- Iteration 5 -- +string(3) "123" +string(3) "1bc" +-- Iteration 6 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 7 -- +string(14) "abc +123 +a1b2c3" +string(14) "a23 +1bc +a1b2c3" +*** Done *** diff --git a/tests/std/strings/strtr_variation2.phpt b/tests/std/strings/strtr_variation2.phpt new file mode 100644 index 00000000..35cbc1f0 --- /dev/null +++ b/tests/std/strings/strtr_variation2.phpt @@ -0,0 +1,84 @@ +--TEST-- +Test strtr() function : usage variations - string containing special chars for 'str' argument +--FILE-- + "%", "%" => "$", "#*&@()" => "()@&*#"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strtr() : string containing special chars for 'str' arg *** +-- Iteration 1 -- +string(1) "s" +string(1) "$" +-- Iteration 2 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 3 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 4 -- +string(1) "s" +string(1) "$" +-- Iteration 5 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 6 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 7 -- +string(17) "s +peci +text i als" +string(17) "$ +#%*& +text & @()" +*** Done *** diff --git a/tests/std/strings/strtr_variation3.phpt b/tests/std/strings/strtr_variation3.phpt new file mode 100644 index 00000000..012baf9a --- /dev/null +++ b/tests/std/strings/strtr_variation3.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test strtr() function : usage variations - string containing escape sequences for 'str' argument +--FILE-- + "t", "\r\n" => "T", "\n\r\t\\" => "TEST"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strtr() : string containing escape sequences for 'str' arg *** +-- Iteration 1 -- +string(9) "SesSTsttE" +string(9) " es \stt " +-- Iteration 2 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 3 -- +string(12) "TtestETstrtr" +string(11) "ttestTstrtr" +-- Iteration 4 -- +string(9) "$variable" +string(9) "$variable" +-- Iteration 5 -- +string(7) ""quotes" +string(7) ""quotes" +-- Iteration 6 -- +string(12) "TtesTtTsttTr" +string(12) "\tes\t\stt\r" +-- Iteration 7 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 8 -- +string(15) "TntestTrTnstrtr" +string(15) "\ntest\r\nstrtr" +-- Iteration 9 -- +string(10) "T$variable" +string(10) "\$variable" +-- Iteration 10 -- +string(8) "T"quotes" +string(8) "\"quotes" +-- Iteration 11 -- +string(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes" +string(52) " es \sttT\test\\strtrtttestTstrtrt$variablet\"quotes" +*** Done *** diff --git a/tests/std/strings/strtr_variation4.phpt b/tests/std/strings/strtr_variation4.phpt new file mode 100644 index 00000000..f89ff654 --- /dev/null +++ b/tests/std/strings/strtr_variation4.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test strtr() function : usage variations - empty string & null for 'str' argument +--FILE-- + "t", '' => "TEST"); + + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strtr() : empty string & null for 'str' arg *** +-- Iteration 1 -- +string(0) "" +string(0) "" +-- Iteration 2 -- +string(0) "" +string(0) "" +-- Iteration 3 -- +string(0) "" +string(0) "" +-- Iteration 4 -- +string(0) "" +string(0) "" +-- Iteration 5 -- +string(0) "" +string(0) "" +*** Done *** diff --git a/tests/std/strings/strtr_variation6.phpt b/tests/std/strings/strtr_variation6.phpt new file mode 100644 index 00000000..65c59d75 --- /dev/null +++ b/tests/std/strings/strtr_variation6.phpt @@ -0,0 +1,120 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'from' argument +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } + $count++; +} + +fclose($file_handle); //closing the file handle +?> +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'from' *** +-- Iteration 1 -- +string(6) "a12atm" +-- Iteration 2 -- +string(6) "0a2atm" +-- Iteration 3 -- +string(6) "01tatm" +-- Iteration 4 -- +string(6) "ta2atm" +-- Iteration 5 -- +string(6) "m1tatm" +-- Iteration 6 -- +string(6) "tm0atm" +-- Iteration 7 -- +strtr(): Argument #2 ($from) must be of type string, array given +-- Iteration 8 -- +strtr(): Argument #2 ($from) must be of type string, array given +-- Iteration 9 -- +strtr(): Argument #2 ($from) must be of type string, array given +-- Iteration 10 -- +string(6) "0a2atm" +-- Iteration 11 -- +string(6) "012atm" +-- Iteration 12 -- +string(6) "0a2atm" +-- Iteration 13 -- +string(6) "012atm" +-- Iteration 14 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d +string(6) "012atm" +-- Iteration 15 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d +string(6) "012atm" +-- Iteration 16 -- +string(6) "012ttm" +-- Iteration 17 -- +strtr(): Argument #2 ($from) must be of type string, resource given diff --git a/tests/std/strings/strtr_variation8.phpt b/tests/std/strings/strtr_variation8.phpt new file mode 100644 index 00000000..9bf99bd8 --- /dev/null +++ b/tests/std/strings/strtr_variation8.phpt @@ -0,0 +1,134 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' argument +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } + + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECT-- +*** Testing strtr() function: with unexpected inputs for 'replace_pairs' *** + +-- Iteration 1 -- +strtr(): Argument #2 ($from) must be of type array, int given + +-- Iteration 2 -- +strtr(): Argument #2 ($from) must be of type array, int given + +-- Iteration 3 -- +strtr(): Argument #2 ($from) must be of type array, int given + +-- Iteration 4 -- +strtr(): Argument #2 ($from) must be of type array, float given + +-- Iteration 5 -- +strtr(): Argument #2 ($from) must be of type array, float given + +-- Iteration 6 -- +strtr(): Argument #2 ($from) must be of type array, float given + +-- Iteration 7 -- +string(6) "012atm" + +-- Iteration 8 -- +string(6) "012atm" + +-- Iteration 9 -- +string(6) "122atm" + +-- Iteration 10 -- +strtr(): Argument #2 ($from) must be of type array, true given + +-- Iteration 11 -- +strtr(): Argument #2 ($from) must be of type array, false given + +-- Iteration 12 -- +strtr(): Argument #2 ($from) must be of type array, true given + +-- Iteration 13 -- +strtr(): Argument #2 ($from) must be of type array, false given + +-- Iteration 14 -- +strtr(): Argument #2 ($from) must be of type array, null given + +-- Iteration 15 -- +strtr(): Argument #2 ($from) must be of type array, null given + +-- Iteration 16 -- +strtr(): Argument #2 ($from) must be of type array, sample given + +-- Iteration 17 -- +strtr(): Argument #2 ($from) must be of type array, resource given +*** Done *** diff --git a/tests/std/strings/strtr_with_reference.phpt b/tests/std/strings/strtr_with_reference.phpt new file mode 100644 index 00000000..21cdc203 --- /dev/null +++ b/tests/std/strings/strtr_with_reference.phpt @@ -0,0 +1,12 @@ +--TEST-- +strtr() with references +--FILE-- + &$foo]; +var_dump(strtr('foobar', $arr)); + +?> +--EXPECT-- +string(6) "foofoo" diff --git a/tests/std/strings/strval.phpt b/tests/std/strings/strval.phpt new file mode 100644 index 00000000..4d896ba1 --- /dev/null +++ b/tests/std/strings/strval.phpt @@ -0,0 +1,30 @@ +--TEST-- +strval() function +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(3) "bar" +string(3) "BAR" +string(6) "foobar" +string(1) "1" +string(3) "1.1" +string(1) "1" +string(0) "" + +Warning: Array to string conversion in %s on line %d +string(5) "Array" diff --git a/tests/std/strings/strval_basic.phpt b/tests/std/strings/strval_basic.phpt new file mode 100644 index 00000000..71131c26 --- /dev/null +++ b/tests/std/strings/strval_basic.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test strval() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing strval() : basic variations *** + +-- Iteration 1 -- +string(11) "Hello World" + +-- Iteration 2 -- +string(11) "Hello World" + +-- Iteration 3 -- +string(32) "String +with +control +characters +" + +-- Iteration 4 -- +string(20) "String with "quotes"" + +-- Iteration 5 -- +string(6) "123456" + +-- Iteration 6 -- +string(5) "0xABC" + +-- Iteration 7 -- +string(21) "Simple HEREDOC string" diff --git a/tests/std/strings/strval_error.phpt b/tests/std/strings/strval_error.phpt new file mode 100644 index 00000000..a71e54aa --- /dev/null +++ b/tests/std/strings/strval_error.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test strval() function : usage variations - error conditions +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +*** Testing strval() : error conditions *** + +-- Testing strval() function with object which has not toString() method -- +Object of class MyClass could not be converted to string diff --git a/tests/std/strings/strval_variation1.phpt b/tests/std/strings/strval_variation1.phpt new file mode 100644 index 00000000..4635b2e7 --- /dev/null +++ b/tests/std/strings/strval_variation1.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test strval() function : usage variations - Pass different data types as strval +--SKIPIF-- + +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*20*/ NULL, + null, + + // boolean data +/*22*/ true, + false, + TRUE, + FALSE, + + // empty data +/*26*/ "", + '', + + // object data +/*28*/ new MyClass(), + + // resource +/*29*/ $file_handle, + + // undefined data +/*30*/ @$undefined_var, + + // unset data +/*31*/ @$unset_var, +); + +// loop through each element of the array for strval +$iterator = 1; +foreach($values as $value) { + echo "\n-- Iteration $iterator --\n"; + var_dump( strval($value) ); + $iterator++; +}; +?> +--EXPECTF-- +*** Testing strval() : usage variations *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" + +-- Iteration 4 -- +string(6) "-12345" + +-- Iteration 5 -- +string(1) "2" + +-- Iteration 6 -- +string(1) "8" + +-- Iteration 7 -- +string(5) "12345" + +-- Iteration 8 -- +string(6) "-12345" + +-- Iteration 9 -- +string(1) "0" + +-- Iteration 10 -- +string(1) "1" + +-- Iteration 11 -- +string(5) "43981" + +-- Iteration 12 -- +string(6) "-43981" + +-- Iteration 13 -- +string(5) "100.5" + +-- Iteration 14 -- +string(6) "-100.5" + +-- Iteration 15 -- +string(13) "1001234567000" + +-- Iteration 16 -- +string(14) "1.007654321E-8" + +-- Iteration 17 -- +string(3) "0.5" + +-- Iteration 18 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 19 -- + +Warning: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 20 -- +string(0) "" + +-- Iteration 21 -- +string(0) "" + +-- Iteration 22 -- +string(1) "1" + +-- Iteration 23 -- +string(0) "" + +-- Iteration 24 -- +string(1) "1" + +-- Iteration 25 -- +string(0) "" + +-- Iteration 26 -- +string(0) "" + +-- Iteration 27 -- +string(0) "" + +-- Iteration 28 -- +string(7) "MyClass" + +-- Iteration 29 -- +string(%d) "Resource id #%d" + +-- Iteration 30 -- +string(0) "" + +-- Iteration 31 -- +string(0) "" diff --git a/tests/std/strings/strval_variation2.phpt b/tests/std/strings/strval_variation2.phpt new file mode 100644 index 00000000..46bf9dc3 --- /dev/null +++ b/tests/std/strings/strval_variation2.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test strval() function : usage variations - Pass all valid char codes +--FILE-- + +--EXPECT-- +*** Testing strval() : usage variations - Pass all valid char codes *** +000102030405060708090a0b0c0d0e0f +101112131415161718191a1b1c1d1e1f +202122232425262728292a2b2c2d2e2f +303132333435363738393a3b3c3d3e3f +404142434445464748494a4b4c4d4e4f +505152535455565758595a5b5c5d5e5f +606162636465666768696a6b6c6d6e6f +707172737475767778797a7b7c7d7e7f +808182838485868788898a8b8c8d8e8f +909192939495969798999a9b9c9d9e9f +a0a1a2a3a4a5a6a7a8a9aaabacadaeaf +b0b1b2b3b4b5b6b7b8b9babbbcbdbebf +c0c1c2c3c4c5c6c7c8c9cacbcccdcecf +d0d1d2d3d4d5d6d7d8d9dadbdcdddedf +e0e1e2e3e4e5e6e7e8e9eaebecedeeef +f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff diff --git a/tests/std/strings/substr.phpt b/tests/std/strings/substr.phpt new file mode 100644 index 00000000..4e5c70ea --- /dev/null +++ b/tests/std/strings/substr.phpt @@ -0,0 +1,180 @@ +--TEST-- +Testing substr() function +--SKIPIF-- + +--FILE-- +, < and = 0 */ + + echo ("\n--- Iteration ".$counter." ---\n"); + echo ("\n-- Variations for two arguments --\n"); + var_dump ( substr($str, 1) ); + var_dump ( substr($str, 0) ); + var_dump ( substr($str, -2) ); + + /* variations with three arguments */ + /* start value variations with length values */ + + echo ("\n-- Variations for three arguments --\n"); + var_dump ( substr($str, 1, 3) ); + var_dump ( substr($str, 1, 0) ); + var_dump ( substr($str, 1, -3) ); + var_dump ( substr($str, 0, 3) ); + var_dump ( substr($str, 0, 0) ); + var_dump ( substr($str, 0, -3) ); + var_dump ( substr($str, -2, 3) ); + var_dump ( substr($str, -2, 0 ) ); + var_dump ( substr($str, -2, -3) ); + + $counter++; +} + +/* variation of start and length to point to same element */ +echo ("\n*** Testing for variations of start and length to point to same element ***\n"); +var_dump (substr("abcde" , 2, -2) ); +var_dump (substr("abcde" , -3, -2) ); + +/* Testing to return empty string when start denotes the position beyond the truncation (set by negative length) */ +echo ("\n*** Testing for start > truncation ***\n"); +var_dump (substr("abcdef" , 4, -4) ); + +/* String with null character */ +echo ("\n*** Testing for string with null characters ***\n"); +var_dump (substr("abc\x0xy\x0z" ,2) ); + +/* String with international characters */ +echo ("\n*** Testing for string with international characters ***\n"); +var_dump (substr('\xIñtërnâtiônàlizætiøn',3) ); + +/* start <0 && -start > length */ +echo "\n*** Start before the first char ***\n"; +var_dump (substr("abcd" , -8) ); + +/* Omitting length and passing a NULL length */ +echo "\n*** Omitting length or using NULL length ***\n"; +var_dump (substr("abcdef" , 2) ); +var_dump (substr("abcdef" , 2, NULL) ); + +echo"\nDone"; + +?> +--EXPECTF-- +--- Iteration 1 --- + +-- Variations for two arguments -- +string(0) "" +string(0) "" +string(0) "" + +-- Variations for three arguments -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" + +--- Iteration 2 --- + +-- Variations for two arguments -- +string(4) "2345" +string(5) "12345" +string(2) "45" + +-- Variations for three arguments -- +string(3) "234" +string(0) "" +string(1) "2" +string(3) "123" +string(0) "" +string(2) "12" +string(2) "45" +string(0) "" +string(0) "" + +--- Iteration 3 --- + +-- Variations for two arguments -- +string(5) "bcdef" +string(6) "abcdef" +string(2) "ef" + +-- Variations for three arguments -- +string(3) "bcd" +string(0) "" +string(2) "bc" +string(3) "abc" +string(0) "" +string(3) "abc" +string(2) "ef" +string(0) "" +string(0) "" + +--- Iteration 4 --- + +-- Variations for two arguments -- +string(5) "23abc" +string(6) "123abc" +string(2) "bc" + +-- Variations for three arguments -- +string(3) "23a" +string(0) "" +string(2) "23" +string(3) "123" +string(0) "" +string(3) "123" +string(2) "bc" +string(0) "" +string(0) "" + +--- Iteration 5 --- + +-- Variations for two arguments -- +string(6) "123abc" +string(7) "_123abc" +string(2) "bc" + +-- Variations for three arguments -- +string(3) "123" +string(0) "" +string(3) "123" +string(3) "_12" +string(0) "" +string(4) "_123" +string(2) "bc" +string(0) "" +string(0) "" + +*** Testing for variations of start and length to point to same element *** +string(1) "c" +string(1) "c" + +*** Testing for start > truncation *** +string(0) "" + +*** Testing for string with null characters *** +string(6) "c%0xy%0z" + +*** Testing for string with international characters *** +string(26) "ñtërnâtiônàlizætiøn" + +*** Start before the first char *** +string(4) "abcd" + +*** Omitting length or using NULL length *** +string(4) "cdef" +string(4) "cdef" + +Done diff --git a/tests/std/strings/substr_compare.phpt b/tests/std/strings/substr_compare.phpt new file mode 100644 index 00000000..51d093a6 --- /dev/null +++ b/tests/std/strings/substr_compare.phpt @@ -0,0 +1,38 @@ +--TEST-- +substr_compare() +--FILE-- + 0); +var_dump(substr_compare("abcde", "cd", 1, 2) < 0); +var_dump(substr_compare("abcde", "abc", 5, 1)); +var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0); +var_dump(substr_compare("abcde", "abc", 0, 0)); +echo "Test\n"; + +try { + substr_compare("abcde", "abc", 0, -1); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); +?> +--EXPECT-- +bool(true) +bool(true) +int(0) +int(0) +int(0) +bool(true) +bool(true) +int(-1) +bool(true) +int(0) +Test +substr_compare(): Argument #4 ($length) must be greater than or equal to 0 +bool(true) diff --git a/tests/std/strings/substr_count_basic.phpt b/tests/std/strings/substr_count_basic.phpt new file mode 100644 index 00000000..fd2e3a77 --- /dev/null +++ b/tests/std/strings/substr_count_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test substr_count() function (basic) +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +try { + substr_count("a", ""); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} +var_dump(substr_count("", "a")); +var_dump(substr_count("", "a")); +var_dump(substr_count("", chr(0))); + +$a = str_repeat("abcacba", 100); +var_dump(substr_count($a, "bca")); + +$a = str_repeat("abcacbabca", 100); +var_dump(substr_count($a, "bca")); +var_dump(substr_count($a, "bca", 200)); +var_dump(substr_count($a, "bca", 200, null)); +var_dump(substr_count($a, "bca", 200, 50)); +var_dump(substr_count($a, "bca", -200)); +var_dump(substr_count($a, "bca", -200, null)); +var_dump(substr_count($a, "bca", -200, 50)); +var_dump(substr_count($a, "bca", -200, -50)); + +?> +--EXPECT-- +***Testing basic operations *** +substr_count(): Argument #2 ($needle) must not be empty +substr_count(): Argument #2 ($needle) must not be empty +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(160) +int(10) +int(40) +int(40) +int(10) +int(30) diff --git a/tests/std/strings/substr_count_error.phpt b/tests/std/strings/substr_count_error.phpt new file mode 100644 index 00000000..dc0d3d98 --- /dev/null +++ b/tests/std/strings/substr_count_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test substr_count() function (error conditions) +--FILE-- +getMessage() . "\n"; +} + +/* offset > size of the string */ +try { + substr_count($str, "t", 25); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +/* Using offset and length to go beyond the size of the string: + Exception is expected, as length+offset > length of string */ +try { + substr_count($str, "i", 5, 7); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +/* length too small */ +try { + substr_count($str, "t", 2, -20); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "Done\n"; + +?> +--EXPECT-- +*** Testing error conditions *** +substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +substr_count(): Argument #3 ($offset) must be contained in argument #1 ($haystack) +substr_count(): Argument #4 ($length) must be contained in argument #1 ($haystack) +substr_count(): Argument #4 ($length) must be contained in argument #1 ($haystack) +Done diff --git a/tests/std/strings/substr_count_variation_001.phpt b/tests/std/strings/substr_count_variation_001.phpt new file mode 100644 index 00000000..d7ac3dcd --- /dev/null +++ b/tests/std/strings/substr_count_variation_001.phpt @@ -0,0 +1,69 @@ +--TEST-- +Test substr_count() function (variation - 1) +--FILE-- + +--EXPECT-- +*** Testing possible variations *** +-- 3rd or 4th arg as string -- +int(1) +int(1) + +-- overlapped substrings -- +int(2) +int(2) + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/tests/std/strings/substr_count_variation_002.phpt b/tests/std/strings/substr_count_variation_002.phpt new file mode 100644 index 00000000..9bf41dab --- /dev/null +++ b/tests/std/strings/substr_count_variation_002.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test substr_count() function (variation - 2) +--FILE-- + +--EXPECT-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/tests/std/strings/substr_int_min.phpt b/tests/std/strings/substr_int_min.phpt new file mode 100644 index 00000000..4c00577e --- /dev/null +++ b/tests/std/strings/substr_int_min.phpt @@ -0,0 +1,10 @@ +--TEST-- +substr() with PHP_INT_MIN offset or length +--FILE-- + +--EXPECT-- +string(1) "x" +string(0) "" diff --git a/tests/std/strings/substr_replace.phpt b/tests/std/strings/substr_replace.phpt new file mode 100644 index 00000000..3f9a37fe --- /dev/null +++ b/tests/std/strings/substr_replace.phpt @@ -0,0 +1,813 @@ +--TEST-- +substr_replace() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +substr_replace('try this', 'bala ', 2) +string(7) "trbala " + +substr_replace('try this', 'bala ', 2, 3) +string(10) "trbala his" + +substr_replace('try this', 'bala ', 2, 0) +string(13) "trbala y this" + +substr_replace('try this', 'bala ', 2, -2) +string(9) "trbala is" + + + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(9) "try bala " + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(10) "try bala s" + + + + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,) +array(1) { + [0]=> + string(9) "ala bala " +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 3,)) +array(1) { + [0]=> + string(15) "ala bala tokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 0,)) +array(1) { + [0]=> + string(18) "ala bala portokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => -2,)) +array(1) { + [0]=> + string(11) "ala bala la" +} + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',4) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "try s" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "try bala s" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "try bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(6) "try is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(11) "try bala is" +} + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) " this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "bala try this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "bala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "trbala his" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(4) "tris" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(9) "trbala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "trbala " +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(6) "trthis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(11) "trbala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(10) "trbala his" +} diff --git a/tests/std/strings/substr_replace_array.phpt b/tests/std/strings/substr_replace_array.phpt new file mode 100644 index 00000000..240e8c10 --- /dev/null +++ b/tests/std/strings/substr_replace_array.phpt @@ -0,0 +1,19 @@ +--TEST-- +substr_replace() function - array +--FILE-- + 'llsskdkk','def' => 'llsskjkkdd', 4 => 'hello', 42 => 'world'); +$newarr = substr_replace($arr, 'zzz', 0, -2); + +print_r($newarr); + +?> +--EXPECT-- +Array +( + [abc] => zzzkk + [def] => zzzdd + [4] => zzzlo + [42] => zzzld +) diff --git a/tests/std/strings/substr_replace_array_unset.phpt b/tests/std/strings/substr_replace_array_unset.phpt new file mode 100644 index 00000000..ff253d39 --- /dev/null +++ b/tests/std/strings/substr_replace_array_unset.phpt @@ -0,0 +1,27 @@ +--TEST-- +substr_replace() function - array with unset +--FILE-- + 'bar', 'baz']; +unset($replacement[42]); +$newarr = substr_replace(['1 string', '2 string'], $replacement, 0); +print_r($newarr); + +?> +--EXPECT-- +Array +( + [0] => A + [1] => B +) +Array +( + [0] => foo + [1] => baz +) diff --git a/tests/std/strings/substr_replace_error.phpt b/tests/std/strings/substr_replace_error.phpt new file mode 100644 index 00000000..165cc1e6 --- /dev/null +++ b/tests/std/strings/substr_replace_error.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test substr_replace() function : error conditions +--FILE-- +getMessage(), "\n"; +} +try { + var_dump(substr_replace($s1, "evening", 5, array(1))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +*** Testing substr_replace() : error conditions *** + +-- Testing substr_replace() function with start and length as arrays but string not-- +substr_replace(): Argument #3 ($offset) cannot be an array when working on a single string +substr_replace(): Argument #4 ($length) cannot be an array when working on a single string diff --git a/tests/std/strings/trim.diff b/tests/std/strings/trim.diff new file mode 100644 index 00000000..251dc8b1 --- /dev/null +++ b/tests/std/strings/trim.diff @@ -0,0 +1,10 @@ +-- + bool(true) + bool(true) + bool(true) +016- bool(true) +017- bool(true) +018- bool(true) +016+ bool(false) +017+ bool(false) +018+ bool(false) diff --git a/tests/std/strings/trim.exp b/tests/std/strings/trim.exp new file mode 100644 index 00000000..71739f30 --- /dev/null +++ b/tests/std/strings/trim.exp @@ -0,0 +1,18 @@ +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) \ No newline at end of file diff --git a/tests/std/strings/trim.log b/tests/std/strings/trim.log new file mode 100644 index 00000000..ab8bfd67 --- /dev/null +++ b/tests/std/strings/trim.log @@ -0,0 +1,40 @@ + +---- EXPECTED OUTPUT +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +---- ACTUAL OUTPUT +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) +---- FAILED diff --git a/tests/std/strings/trim.out b/tests/std/strings/trim.out new file mode 100644 index 00000000..0820f275 --- /dev/null +++ b/tests/std/strings/trim.out @@ -0,0 +1,18 @@ +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) \ No newline at end of file diff --git a/tests/std/strings/trim.php b/tests/std/strings/trim.php new file mode 100644 index 00000000..c1fea925 --- /dev/null +++ b/tests/std/strings/trim.php @@ -0,0 +1,25 @@ + +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/tests/std/strings/trim.sh b/tests/std/strings/trim.sh new file mode 100755 index 00000000..04e36154 --- /dev/null +++ b/tests/std/strings/trim.sh @@ -0,0 +1,106 @@ +#!/bin/sh + +unset $(env | cut -d= -f1) +export SHELL='/bin/bash' +export COREPACK_ENABLE_AUTO_PIN='0' +export SESSION_MANAGER='local/swoole-26:@/tmp/.ICE-unix/3966,unix/swoole-26:/tmp/.ICE-unix/3966' +export QT_ACCESSIBILITY='1' +export COLORTERM='truecolor' +export XDG_CONFIG_DIRS='/etc/xdg/xdg-ubuntu:/etc/xdg' +export SSH_AGENT_LAUNCHER='gnome-keyring' +export XDG_MENU_PREFIX='gnome-' +export GNOME_DESKTOP_SESSION_ID='this-is-deprecated' +export GTK_IM_MODULE='fcitx' +export AI_AGENT='claude-code_2-1-143_agent' +export LANGUAGE='zh_CN:zh:en_US:en' +export CLAUDE_CODE_SESSION_ID='2b8f004d-cd4c-49e8-a69a-c1a760f0576b' +export LC_ADDRESS='zh_CN.UTF-8' +export GNOME_SHELL_SESSION_MODE='ubuntu' +export LC_NAME='zh_CN.UTF-8' +export SSH_AUTH_SOCK='/run/user/1000/keyring/ssh' +export CLAUDE_EFFORT='high' +export XMODIFIERS='@im=fcitx' +export DESKTOP_SESSION='ubuntu' +export LC_MONETARY='zh_CN.UTF-8' +export GTK_MODULES='gail:atk-bridge' +export PWD='/home/swoole/workspace/aot/compiler' +export LOGNAME='swoole' +export XDG_SESSION_DESKTOP='ubuntu' +export XDG_SESSION_TYPE='x11' +export GPG_AGENT_INFO='/run/user/1000/gnupg/S.gpg-agent:0:1' +export SYSTEMD_EXEC_PID='8519' +export XAUTHORITY='/run/user/1000/gdm/Xauthority' +export PHPBREW_HOME='/home/swoole/.phpbrew' +export NoDefaultCurrentDirectoryInExePath='1' +export CLAUDECODE='1' +export WINDOWPATH='2' +export HOME='/home/swoole' +export USERNAME='swoole' +export IM_CONFIG_PHASE='1' +export LANG='zh_CN.UTF-8' +export LC_PAPER='zh_CN.UTF-8' +export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:' +export XDG_CURRENT_DESKTOP='ubuntu:GNOME' +export VTE_VERSION='6800' +export GNOME_TERMINAL_SCREEN='/org/gnome/Terminal/screen/dcdedd7b_a193_4708_9f60_953b8ad197db' +export ANTHROPIC_BASE_URL='https://api.deepseek.com/anthropic' +export CLUTTER_IM_MODULE='fcitx' +export PHPBREW_ROOT='/home/swoole/.phpbrew' +export LESSCLOSE='/usr/bin/lesspipe %s %s' +export XDG_SESSION_CLASS='user' +export LC_IDENTIFICATION='zh_CN.UTF-8' +export TERM='xterm-256color' +export LESSOPEN='| /usr/bin/lesspipe %s' +export USER='swoole' +export GNOME_TERMINAL_SERVICE=':1.124' +export DISPLAY=':1' +export SHLVL='2' +export GIT_EDITOR='true' +export LC_TELEPHONE='zh_CN.UTF-8' +export QT_IM_MODULE='fcitx' +export LC_MEASUREMENT='zh_CN.UTF-8' +export ANTHROPIC_MODEL='deepseek-v4-pro' +export XDG_RUNTIME_DIR='/run/user/1000' +export ANTHROPIC_AUTH_TOKEN='sk-2589037b3ccd47638419865c759811b5' +export CLAUDE_CODE_ENTRYPOINT='cli' +export LC_TIME='zh_CN.UTF-8' +export XDG_DATA_DIRS='/usr/share/ubuntu:/usr/share/gnome:/home/swoole/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop' +export CLAUDE_CODE_EXECPATH='/home/swoole/.local/share/claude/versions/2.1.143' +export PATH='/home/swoole/.npm-global/bin:/home/swoole/.local/bin:/home/swoole/.cargo/bin:/home/swoole/bin:/home/swoole/.config/composer/vendor/bin:/home/swoole/soft/node-v22.19.0-linux-x64/bin:/home/swoole/.npm-global/bin:/home/swoole/.local/bin:/home/swoole/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin' +export ANTHROPIC_SMALL_FAST_MODEL='deepseek-v4-pro' +export GDMSESSION='ubuntu' +export DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus' +export LC_NUMERIC='zh_CN.UTF-8' +export _='/home/swoole/bin/php' +export TEMP='/tmp' +export SKIP_ONLINE_TESTS='1' +export SKIP_IO_CAPTURE_TESTS='1' +export TEST_PHP_EXECUTABLE='/opt/php-8.4/bin/php' +export TEST_PHP_EXECUTABLE_ESCAPED=''\''/opt/php-8.4/bin/php'\''' +export TEST_PHP_CGI_EXECUTABLE='/opt/php-8.4/bin/php-cgi' +export TEST_PHP_CGI_EXECUTABLE_ESCAPED=''\''/opt/php-8.4/bin/php-cgi'\''' +export TEST_PHPDBG_EXECUTABLE='/opt/php-8.4/bin/phpdbg' +export TEST_PHPDBG_EXECUTABLE_ESCAPED=''\''/opt/php-8.4/bin/phpdbg'\''' +export REDIRECT_STATUS='1' +export PATH_TRANSLATED='/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php' +export SCRIPT_FILENAME='/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php' +export REQUEST_METHOD='GET' +export TEST_PHP_EXTRA_ARGS=' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off"' + +case "$1" in +"gdb") + gdb -ex 'unset environment LINES' -ex 'unset environment COLUMNS' --args '/opt/php-8.4/bin/php' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off" -f "/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php" 2>&1 + ;; +"lldb") + lldb -- '/opt/php-8.4/bin/php' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off" -f "/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php" 2>&1 + ;; +"valgrind") + USE_ZEND_ALLOC=0 valgrind $2 '/opt/php-8.4/bin/php' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off" -f "/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php" 2>&1 + ;; +"rr") + rr record $2 '/opt/php-8.4/bin/php' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off" -f "/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php" 2>&1 + ;; +*) + '/opt/php-8.4/bin/php' -d "output_handler=" -d "open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d "error_reporting=30719" -d "fatal_error_backtraces=Off" -d "display_errors=1" -d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d "track_errors=0" -d "report_zend_debug=0" -d "docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d "error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d "ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1" -d "memory_limit=128M" -d "opcache.fast_shutdown=0" -d "opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d "opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.protect_memory=1" -d "zend.assertions=1" -d "zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d "session.auto_start=0" -d "zlib.output_compression=Off" -f "/home/swoole/workspace/aot/compiler/tests/std/strings/trim.php" 2>&1 + ;; +esac \ No newline at end of file diff --git a/tests/std/strings/trim1.phpt b/tests/std/strings/trim1.phpt new file mode 100644 index 00000000..75b7ea77 --- /dev/null +++ b/tests/std/strings/trim1.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test trim() function +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(0) "" +string(1) "0" +string(1) "0" +string(13) " testing trim" +string(15) " testing trim " + +*** Testing with OBJECTS *** +string(4) "bjec" + +*** Testing with String with embedded NULL *** +string(22) "234%005678%000efgh\xijkl" + +*** Testing with heredoc string *** +string(12) " heredoc str" + +Done diff --git a/tests/std/strings/trim_basic.phpt b/tests/std/strings/trim_basic.phpt new file mode 100644 index 00000000..db41f27c --- /dev/null +++ b/tests/std/strings/trim_basic.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test trim() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing trim() : basic functionality *** + +-- Trim string with all white space characters -- +string(27) "---These are a few words---" + +-- Trim non-whitespace from a string -- +string(11) "Hello World" + +-- Trim some non-white space characters from a string -- +string(19) "!===Hello World===!" + +-- Trim the ASCII control characters at the beginning of a string -- +string(14) "Example string" diff --git a/tests/std/strings/trim_error.phpt b/tests/std/strings/trim_error.phpt new file mode 100644 index 00000000..3cf7808a --- /dev/null +++ b/tests/std/strings/trim_error.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test trim() function : error conditions +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing trim() : error conditions *** + +-- Test trim function with various invalid charlists -- + +Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range, no character to the right of '..' in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +string(14) " Hello World +" + +Warning: trim(): Invalid '..'-range in %s on line %d +string(14) " Hello World +" diff --git a/tests/std/strings/ucfirst.phpt b/tests/std/strings/ucfirst.phpt new file mode 100644 index 00000000..236e5f61 --- /dev/null +++ b/tests/std/strings/ucfirst.phpt @@ -0,0 +1,171 @@ +--TEST-- +"ucfirst()" function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Deprecated: Using ${var} in strings is deprecated, use {$var} instead in %s on line %d +#### Basic and Various operations #### +string(16) "Testing ucfirst." +string(17) "1.testing ucfirst" +string(11) "HELLO wORLD" +string(11) "HELLO wORLD" +string(1) "%0" +string(1) "%0" +string(2) "%00" +string(4) "Abcd" +string(3) "Xyz" +string(2) "-3" +string(2) "-3" +string(6) "-3.344" +string(6) "-3.344" +string(4) "NULL" +string(1) "0" +string(1) "0" +string(1) "1" +string(4) "TRUE" +string(1) "1" +string(1) "1" +string(8) "1.234444" +string(0) "" +string(5) "FALSE" +string(1) " " +string(5) " " +string(1) "B" +string(2) "\t" +string(1) " " +string(2) "12" +string(8) "12twelve" + +#### Testing miscellaneous inputs #### + +--- Testing objects --- +string(12) "Hello, world" + +--- Testing a longer and heredoc string --- +string(639) "Abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789 +@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&* +abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" + +--- Testing a heredoc null string --- +string(0) "" + +--- Testing simple and complex syntax strings --- +string(5) "World" +string(7) "World'S" + +Warning: Undefined variable $strS in %s on line %d +string(0) "" +string(6) "WorldS" +string(6) "WorldS" + +--- Nested ucfirst() --- +string(5) "Hello" +Done diff --git a/tests/std/strings/ucwords_basic.phpt b/tests/std/strings/ucwords_basic.phpt new file mode 100644 index 00000000..63b8eaa3 --- /dev/null +++ b/tests/std/strings/ucwords_basic.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test ucwords() function : basic functionality +--FILE-- + +--EXPECT-- +*** Testing ucwords() : basic functionality *** +-- Iteration 1 -- +string(15) "Testing Ucwords" +-- Iteration 2 -- +string(15) "Testing Ucwords" +-- Iteration 3 -- +string(16) "Testing\tucwords" +-- Iteration 4 -- +string(15) "Testing Ucwords" +-- Iteration 5 -- +string(15) "Testing +Ucwords" +-- Iteration 6 -- +string(16) "Testing\nucwords" +-- Iteration 7 -- +string(15) "Testing Ucwords" +-- Iteration 8 -- +string(16) "Testing\vucwords" +-- Iteration 9 -- +string(7) "Testing" +-- Iteration 10 -- +string(7) "Testing" +-- Iteration 11 -- +string(8) " Testing" +-- Iteration 12 -- +string(8) " Testing" +-- Iteration 13 -- +string(16) "Testing Ucwords" +-- Iteration 14 -- +string(16) "Testing Ucwords" +-- Iteration 15 -- +string(16) "Testing\rucwords" +-- Iteration 16 -- +string(15) "Testing Ucwords" +-- Iteration 17 -- +string(16) "Testing\fucwords" +-- Iteration 18 -- +string(15) "Testing Ucwords" +Done diff --git a/tests/std/strings/ucwords_variation2.phpt b/tests/std/strings/ucwords_variation2.phpt new file mode 100644 index 00000000..8e2e3a6f --- /dev/null +++ b/tests/std/strings/ucwords_variation2.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test ucwords() function : usage variations - heredoc strings +--FILE-- + +--EXPECT-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(52) "Testing Ucword() With +Multiline String Using +Heredoc" +-- Iteration 4 -- +string(93) "Testing Ucword(str) With +Multiline String Using +Heredoc +String.with Different White Spaces" +-- Iteration 5 -- +string(53) "12sting 123string 4567 +String 123string 12 Test +5test" +-- Iteration 6 -- +string(108) "It's Bright,but I Cann't See It. +"things In Double Quote" +'things In Single Quote' +This\line Is /with\slashs" +Done diff --git a/tests/std/strings/ucwords_variation3.phpt b/tests/std/strings/ucwords_variation3.phpt new file mode 100644 index 00000000..8e693647 --- /dev/null +++ b/tests/std/strings/ucwords_variation3.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test ucwords() function : usage variations - single quoted string +--FILE-- + +--EXPECT-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(23) ""testing",ucword,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(11) "'t 't',test" +-- Iteration 10 -- +string(27) "\ttesting\ttesting\tucwords" +-- Iteration 11 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 12 -- +string(37) "Testing\fucwords \f Testing \nucwords" +-- Iteration 13 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 14 -- +string(20) "Using\vvertical\vtab" +-- Iteration 15 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 16 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 17 -- +string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/" +-- Iteration 18 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/tests/std/strings/ucwords_variation4.phpt b/tests/std/strings/ucwords_variation4.phpt new file mode 100644 index 00000000..70dbe466 --- /dev/null +++ b/tests/std/strings/ucwords_variation4.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test ucwords() function : usage variations - double quoted string +--FILE-- + +--EXPECT-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(24) ""testing",ucwords,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(14) "\'t \'t\',test" +-- Iteration 10 -- +string(10) "Jack's Pen" +-- Iteration 11 -- +string(14) "P't'y 't It's " +-- Iteration 12 -- +string(24) " Testing Testing Ucwords" +-- Iteration 13 -- +string(26) "\ttesting\ttesting Ucwords" +-- Iteration 14 -- +string(31) "Testing Ucwords Testing Ucwords" +-- Iteration 15 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 16 -- +string(34) "Testing Ucwords Testing +Ucwords" +-- Iteration 17 -- +string(36) "Testing\fucwords \f Testing +Ucwords" +-- Iteration 18 -- +string(35) " +Testing +Ucwords + Testing + Ucwords" +-- Iteration 19 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 20 -- +string(18) "Using Vertical Tab" +-- Iteration 21 -- +string(20) "Using\vvertical\vtab" +-- Iteration 22 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 23 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 24 -- +string(37) "/test/r Est\ucwords \y\y\u \yy\ /uu/" +-- Iteration 25 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/tests/std/strings/ucwords_variation5.phpt b/tests/std/strings/ucwords_variation5.phpt new file mode 100644 index 00000000..b7613f22 --- /dev/null +++ b/tests/std/strings/ucwords_variation5.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test ucwords() function : usage variations - custom delimiters +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +string(%d) "Testing-Dashed-Words" +string(%d) "Test(Braced)Words" +string(%d) "Testing empty delimiters" +string(%d) "TeSting raNgeS" +Done diff --git a/tests/std/strings/unpack_bug68225.phpt b/tests/std/strings/unpack_bug68225.phpt new file mode 100644 index 00000000..c3d1692c --- /dev/null +++ b/tests/std/strings/unpack_bug68225.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #68225 unpack and X format code +--FILE-- + +--EXPECT-- +array(1) { + ["a"]=> + int(1) +} +array(1) { + ["a"]=> + int(1) +} +array(4) { + ["a"]=> + int(1) + ["b"]=> + int(1) + ["c"]=> + int(2) + ["d"]=> + int(2) +} diff --git a/tests/std/strings/unpack_error.phpt b/tests/std/strings/unpack_error.phpt new file mode 100644 index 00000000..c41185b2 --- /dev/null +++ b/tests/std/strings/unpack_error.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test unpack() function : error conditions +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Invalid format type B diff --git a/tests/std/strings/unpack_offset.phpt b/tests/std/strings/unpack_offset.phpt new file mode 100644 index 00000000..bd787859 --- /dev/null +++ b/tests/std/strings/unpack_offset.phpt @@ -0,0 +1,29 @@ +--TEST-- +unpack() with offset +--FILE-- +getMessage(), "\n"; +} +try { + unpack("l", "foo", -1); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +0x01020304 0x05060708 +0x01020304 0x05060708 +unpack(): Argument #3 ($offset) must be contained in argument #2 ($data) +unpack(): Argument #3 ($offset) must be contained in argument #2 ($data) diff --git a/tests/std/strings/url_t.phpt b/tests/std/strings/url_t.phpt new file mode 100644 index 00000000..caa93cb9 --- /dev/null +++ b/tests/std/strings/url_t.phpt @@ -0,0 +1,799 @@ +--TEST-- +parse_url() function +--FILE-- + $url: "; + var_dump(@parse_url($url)); + } + + $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123'; + foreach (array(PHP_URL_SCHEME,PHP_URL_HOST,PHP_URL_PORT,PHP_URL_USER,PHP_URL_PASS,PHP_URL_PATH,PHP_URL_QUERY,PHP_URL_FRAGMENT) as $v) { + var_dump(parse_url($url, $v)); + } +?> +--EXPECT-- +--> : array(1) { + ["path"]=> + string(0) "" +} + +--> 64.246.30.37: array(1) { + ["path"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" + ["path"]=> + string(1) "/" +} + +--> 64.246.30.37/: array(1) { + ["path"]=> + string(13) "64.246.30.37/" +} + +--> 64.246.30.37:80/: array(3) { + ["host"]=> + string(12) "64.246.30.37" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> php.net: array(1) { + ["path"]=> + string(7) "php.net" +} + +--> php.net/: array(1) { + ["path"]=> + string(8) "php.net/" +} + +--> http://php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" +} + +--> http://php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net: array(1) { + ["path"]=> + string(11) "www.php.net" +} + +--> www.php.net/: array(1) { + ["path"]=> + string(12) "www.php.net/" +} + +--> http://www.php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" +} + +--> http://www.php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net:80: array(2) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net/index.php: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" +} + +--> www.php.net/?: array(2) { + ["path"]=> + string(12) "www.php.net/" + ["query"]=> + string(0) "" +} + +--> www.php.net:80/?: array(4) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(0) "" +} + +--> http://www.php.net/?: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(0) "" +} + +--> http://www.php.net:80/?: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(0) "" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/foo/bar/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(18) "/foo/bar/index.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" + ["query"]=> + string(37) "lots=1&of=2¶meters=3&too=4&here=5" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(45) "/this/is/a/very/deep/directory/structure/and/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/../a/../deep/directory: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(28) "/this/../a/../deep/directory" +} + +--> http://www.php.net:80/this/../a/../deep/directory/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(29) "/this/../a/../deep/directory/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(42) "/this/is/a/very/deep/directory/../file.php" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/index.php?: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(0) "" +} + +--> http://www.php.net:80/#foo: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["fragment"]=> + string(3) "foo" +} + +--> http://www.php.net:80/?#: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(0) "" + ["fragment"]=> + string(0) "" +} + +--> http://www.php.net:80/?test=1: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(6) "test=1" +} + +--> http://www.php.net/?test=1&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net:80/?&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?test=1&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net/index.php?&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?foo&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "foo&" +} + +--> http://www.php.net/index.php?&foo: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "&foo" +} + +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" +} + +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(0) "" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(0) "" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hid:out" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> nntp://news.php.net: array(2) { + ["scheme"]=> + string(4) "nntp" + ["host"]=> + string(12) "news.php.net" +} + +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) { + ["scheme"]=> + string(3) "ftp" + ["host"]=> + string(11) "ftp.gnu.org" + ["path"]=> + string(22) "/gnu/glic/glibc.tar.gz" +} + +--> zlib:http://foo@bar: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(14) "http://foo@bar" +} + +--> zlib:filename.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(12) "filename.txt" +} + +--> zlib:/path/to/my/file/file.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(25) "/path/to/my/file/file.txt" +} + +--> foo://foo@bar: array(3) { + ["scheme"]=> + string(3) "foo" + ["host"]=> + string(3) "bar" + ["user"]=> + string(3) "foo" +} + +--> mailto:me@mydomain.com: array(2) { + ["scheme"]=> + string(6) "mailto" + ["path"]=> + string(15) "me@mydomain.com" +} + +--> /foo.php?a=b&c=d: array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> foo.php?a=b&c=d: array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(15) "www.example.com" + ["port"]=> + int(8080) + ["user"]=> + string(4) "user" + ["pass"]=> + string(6) "passwd" + ["query"]=> + string(12) "bar=1&boom=0" +} + +--> file:///path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> file://path/to/file: array(3) { + ["scheme"]=> + string(4) "file" + ["host"]=> + string(4) "path" + ["path"]=> + string(8) "/to/file" +} + +--> file:/path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "1.2.3.4" + ["path"]=> + string(8) "/abc.asp" + ["query"]=> + string(7) "a=1&b=2" +} + +--> http://foo.com#bar: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "foo.com" + ["fragment"]=> + string(3) "bar" +} + +--> scheme:: array(1) { + ["scheme"]=> + string(6) "scheme" +} + +--> foo+bar://baz@bang/bla: array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} + +--> gg:9130731: array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} + +--> http://user:@pass@host/path?argument?value#etc: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(5) "@pass" + ["path"]=> + string(5) "/path" + ["query"]=> + string(14) "argument?value" + ["fragment"]=> + string(3) "etc" +} +string(4) "http" +string(11) "www.php.net" +int(80) +string(6) "secret" +string(7) "hideout" +string(10) "/index.php" +string(31) "test=1&test2=char&test3=mixesCI" +string(16) "some_page_ref123" diff --git a/tests/std/strings/utf8.phpt b/tests/std/strings/utf8.phpt new file mode 100644 index 00000000..e681cb74 --- /dev/null +++ b/tests/std/strings/utf8.phpt @@ -0,0 +1,17 @@ +--TEST-- +UTF-8<->ISO Latin 1 encoding/decoding test +--SKIPIF-- + +--FILE-- + %s\n", urlencode("æ"), urlencode(utf8_encode("æ"))); +printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6"); +?> +--EXPECTF-- +Deprecated: Function utf8_encode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +%E6 -> %C3%A6 + +Deprecated: Function utf8_decode() is deprecated since 8.2, visit the php.net documentation for various alternatives in %s on line %d +%E6 <- %C3%A6 diff --git a/tests/std/strings/uuencode.phpt b/tests/std/strings/uuencode.phpt new file mode 100644 index 00000000..8eb0874d --- /dev/null +++ b/tests/std/strings/uuencode.phpt @@ -0,0 +1,41 @@ +--TEST-- +uuencode family tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(2) "` +" +string(0) "" +string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: +` +" +string(1) "%s" +string(42) "~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL: +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- + +--CLEAN-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality *** +string(17) "Foo is 30 and bar" +int(17) +string(11) "bar bar bar" +int(11) +string(8) "54 digit" +int(8) +string(3) "1 0" +int(3) +string(5) "A B C" +int(5) +string(35) "1.000000e+3 2.000000E+4 2.000000e+2" +int(35) +string(2) "50" +int(2) +string(35) "Testing 1001 6 2.550200 foobar f 41" +int(35) diff --git a/tests/std/strings/vfprintf_basic1.phpt b/tests/std/strings/vfprintf_basic1.phpt new file mode 100644 index 00000000..d37f2a81 --- /dev/null +++ b/tests/std/strings/vfprintf_basic1.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test vfprintf() function : basic functionality - string format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using string format *** +int(4) +int(8) +int(14) +one +one two +one two three diff --git a/tests/std/strings/vfprintf_basic2.phpt b/tests/std/strings/vfprintf_basic2.phpt new file mode 100644 index 00000000..3d51bb75 --- /dev/null +++ b/tests/std/strings/vfprintf_basic2.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test vfprintf() function : basic functionality - integer format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using integer format *** +111 +111 222 +111 222 333 diff --git a/tests/std/strings/vfprintf_basic3.phpt b/tests/std/strings/vfprintf_basic3.phpt new file mode 100644 index 00000000..e8b245b0 --- /dev/null +++ b/tests/std/strings/vfprintf_basic3.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test vfprintf() function : basic functionality - float format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using float format *** +11.110000 +11.110000 +11.110000 22.220000 +11.110000 22.220000 +11.110000 22.220000 33.330000 +11.110000 22.220000 33.330000 diff --git a/tests/std/strings/vfprintf_basic4.phpt b/tests/std/strings/vfprintf_basic4.phpt new file mode 100644 index 00000000..d855b8b4 --- /dev/null +++ b/tests/std/strings/vfprintf_basic4.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test vfprintf() function : basic functionality - bool format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using bool format *** +1 +1 0 +1 0 1 diff --git a/tests/std/strings/vfprintf_basic5.phpt b/tests/std/strings/vfprintf_basic5.phpt new file mode 100644 index 00000000..13d17d00 --- /dev/null +++ b/tests/std/strings/vfprintf_basic5.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test vfprintf() function : basic functionality - char format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using char format *** +A +A B +A B C diff --git a/tests/std/strings/vfprintf_basic6.phpt b/tests/std/strings/vfprintf_basic6.phpt new file mode 100644 index 00000000..a11125c3 --- /dev/null +++ b/tests/std/strings/vfprintf_basic6.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test vfprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using exponential format *** +1.000000e+3 +1.000000e+3 2.000000e+3 +1.000000e+3 2.000000e+3 3.000000e+3 diff --git a/tests/std/strings/vfprintf_basic7.phpt b/tests/std/strings/vfprintf_basic7.phpt new file mode 100644 index 00000000..7f013872 --- /dev/null +++ b/tests/std/strings/vfprintf_basic7.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +4294966185 +4294966185 4293732729 +4294966185 4293732729 4292621864 diff --git a/tests/std/strings/vfprintf_basic7_64bit.phpt b/tests/std/strings/vfprintf_basic7_64bit.phpt new file mode 100644 index 00000000..38922f51 --- /dev/null +++ b/tests/std/strings/vfprintf_basic7_64bit.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +18446744073709550505 +18446744073709550505 18446744073708317049 +18446744073709550505 18446744073708317049 18446744073707206184 diff --git a/tests/std/strings/vfprintf_basic8.phpt b/tests/std/strings/vfprintf_basic8.phpt new file mode 100644 index 00000000..99bf2da0 --- /dev/null +++ b/tests/std/strings/vfprintf_basic8.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test vfprintf() function : basic functionality - octal format +--FILE-- + +--EXPECT-- +*** Testing vfprintf() : basic functionality - using octal format *** +21 +21 347 +21 347 567 diff --git a/tests/std/strings/vfprintf_basic9.phpt b/tests/std/strings/vfprintf_basic9.phpt new file mode 100644 index 00000000..bcbd5320 --- /dev/null +++ b/tests/std/strings/vfprintf_basic9.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test vfprintf) function : basic functionality - hexadecimal format +--FILE-- + +--EXPECT-- +*** Testing vfprintf) : basic functionality - using hexadecimal format *** +b +B +b 84 +B 84 +b 84 b1 +B 84 B1 diff --git a/tests/std/strings/vfprintf_error1.phpt b/tests/std/strings/vfprintf_error1.phpt new file mode 100644 index 00000000..93b20a6c --- /dev/null +++ b/tests/std/strings/vfprintf_error1.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : error conditions (more than expected arguments) +--SKIPIF-- + +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- +getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +// Close handle +fclose($fp); + +?> +--CLEAN-- + +--EXPECT-- +-- Testing vfprintf() function with more than expected no. of arguments -- +vfprintf() expects exactly 3 arguments, 4 given +vfprintf() expects exactly 3 arguments, 4 given diff --git a/tests/std/strings/vfprintf_error3.phpt b/tests/std/strings/vfprintf_error3.phpt new file mode 100644 index 00000000..24991552 --- /dev/null +++ b/tests/std/strings/vfprintf_error3.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test vfprintf() function : error conditions (wrong argument types) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- +getMessage() . "\n"; +} + +try { + vfprintf($fp, "Foo: %s", "not available"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +try { + vfprintf($fp, "Foo %y fake", ["not available"]); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} + +rewind( $fp ); +var_dump( stream_get_contents( $fp ) ); +ftruncate( $fp, 0 ); +rewind( $fp ); + +// Close handle +fclose( $fp ); + +?> +--CLEAN-- + +--EXPECT-- +-- Testing vfprintf() function with wrong variable types as argument -- +vfprintf(): Argument #2 ($format) must be of type string, array given +vfprintf(): Argument #3 ($values) must be of type array, string given +Unknown format specifier "y" +string(0) "" diff --git a/tests/std/strings/vfprintf_error4.phpt b/tests/std/strings/vfprintf_error4.phpt new file mode 100644 index 00000000..7c4578ee --- /dev/null +++ b/tests/std/strings/vfprintf_error4.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test vfprintf() function : error conditions (various conditions) +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- +getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); +} catch(\ValueError $e) { + print('Error found: '.$e->getMessage().".\n"); +} +// Close handle +fclose( $fp ); + +?> +--CLEAN-- + +--EXPECT-- +-- Testing vfprintf() function with other strangeties -- +vfprintf(): Argument #1 ($stream) must be of type resource, string given +Error found: Argument number specifier must be greater than zero and less than 2147483647. diff --git a/tests/std/strings/vfprintf_variation1.phpt b/tests/std/strings/vfprintf_variation1.phpt new file mode 100644 index 00000000..89d07662 --- /dev/null +++ b/tests/std/strings/vfprintf_variation1.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test vfprintf() function : variation functionality +--SKIPIF-- + +--CREDITS-- +Felix De Vliegher +--INI-- +precision=14 +--FILE-- +getMessage() . "\n"; + } +} + +// Test vfprintf() +writeAndDump( $fp, "format", null ); +writeAndDump( $fp, "Foo is %d and %s", array( 30, 'bar' ) ); +writeAndDump( $fp, "Foobar testing", array() ); +writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) ); +writeAndDump( $fp, "%02d", array( 50 ) ); +writeAndDump( $fp, "", array() ); +writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) ); + +// Close handle +fclose( $fp ); + +?> +--CLEAN-- + +--EXPECT-- +*** Testing vfprintf() : variation functionality *** +vfprintf(): Argument #3 ($values) must be of type array, null given +string(17) "Foo is 30 and bar" +int(17) +string(14) "Foobar testing" +int(14) +string(11) "bar bar bar" +int(11) +string(2) "50" +int(2) +string(0) "" +int(0) +string(38) "Testing 1001 6 2.550200 30 foobar f 41" +int(38) diff --git a/tests/std/strings/vprintf_basic1.phpt b/tests/std/strings/vprintf_basic1.phpt new file mode 100644 index 00000000..c7b09c01 --- /dev/null +++ b/tests/std/strings/vprintf_basic1.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test vprintf() function : basic functionality - string format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using string format *** +one +int(3) +one two +int(7) +one two three +int(13) diff --git a/tests/std/strings/vprintf_basic2.phpt b/tests/std/strings/vprintf_basic2.phpt new file mode 100644 index 00000000..e7b7f037 --- /dev/null +++ b/tests/std/strings/vprintf_basic2.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test vprintf() function : basic functionality - integer format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using integer format *** +111 +int(3) +111 222 +int(7) +111 222 333 +int(11) diff --git a/tests/std/strings/vprintf_basic3.phpt b/tests/std/strings/vprintf_basic3.phpt new file mode 100644 index 00000000..d585cf3b --- /dev/null +++ b/tests/std/strings/vprintf_basic3.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test vprintf() function : basic functionality - float format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using float format *** +11.110000 +int(9) +11.110000 +int(9) +11.110000 22.220000 +int(19) +11.110000 22.220000 +int(19) +11.110000 22.220000 33.330000 +int(29) +11.110000 22.220000 33.330000 +int(29) diff --git a/tests/std/strings/vprintf_basic4.phpt b/tests/std/strings/vprintf_basic4.phpt new file mode 100644 index 00000000..d0a30439 --- /dev/null +++ b/tests/std/strings/vprintf_basic4.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vprintf() function : basic functionality - bool format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using bool format *** +1 +int(1) +1 0 +int(3) +1 0 1 +int(5) diff --git a/tests/std/strings/vprintf_basic5.phpt b/tests/std/strings/vprintf_basic5.phpt new file mode 100644 index 00000000..56206a55 --- /dev/null +++ b/tests/std/strings/vprintf_basic5.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vprintf() function : basic functionality - char format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using char format *** +A +int(1) +A B +int(3) +A B C +int(5) diff --git a/tests/std/strings/vprintf_basic6.phpt b/tests/std/strings/vprintf_basic6.phpt new file mode 100644 index 00000000..6d290ab0 --- /dev/null +++ b/tests/std/strings/vprintf_basic6.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using exponential format *** +1.000000e+3 +int(11) +1.000000e+3 2.000000e+3 +int(23) +1.000000e+3 2.000000e+3 3.000000e+3 +int(35) diff --git a/tests/std/strings/vprintf_basic7.phpt b/tests/std/strings/vprintf_basic7.phpt new file mode 100644 index 00000000..e515edac --- /dev/null +++ b/tests/std/strings/vprintf_basic7.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test vprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using unsigned format *** +4294966185 +int(10) +4294966185 4293732729 +int(21) +4294966185 4293732729 4292621864 +int(32) diff --git a/tests/std/strings/vprintf_basic7_64bit.phpt b/tests/std/strings/vprintf_basic7_64bit.phpt new file mode 100644 index 00000000..7f2dd437 --- /dev/null +++ b/tests/std/strings/vprintf_basic7_64bit.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test vprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using unsigned format *** +18446744073709550505 +int(20) +18446744073709550505 18446744073708317049 +int(41) +18446744073709550505 18446744073708317049 18446744073707206184 +int(62) diff --git a/tests/std/strings/vprintf_basic8.phpt b/tests/std/strings/vprintf_basic8.phpt new file mode 100644 index 00000000..95de8557 --- /dev/null +++ b/tests/std/strings/vprintf_basic8.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vprintf() function : basic functionality - octal format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using octal format *** +21 +int(2) +21 347 +int(6) +21 347 567 +int(10) diff --git a/tests/std/strings/vprintf_basic9.phpt b/tests/std/strings/vprintf_basic9.phpt new file mode 100644 index 00000000..5e33b080 --- /dev/null +++ b/tests/std/strings/vprintf_basic9.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test vprintf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECT-- +*** Testing vprintf() : basic functionality - using hexadecimal format *** +b +int(1) +B +int(1) +b 84 +int(4) +B 84 +int(4) +b 84 b1 +int(7) +B 84 B1 +int(7) diff --git a/tests/std/strings/vprintf_variation10.phpt b/tests/std/strings/vprintf_variation10.phpt new file mode 100644 index 00000000..26282b73 --- /dev/null +++ b/tests/std/strings/vprintf_variation10.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vprintf() function : usage variations - char formats with non-char values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different char formats from the above $format array +// and with non-char values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECTF-- +*** Testing vprintf() : char formats and non-char values *** + +-- Iteration 1 -- +A ¿ B + ] ~ ‚ + # Ý à + à = 2 Ê + B ] A ¿ +int(47) + +-- Iteration 2 -- +A ¿ B + © ~ ‚ + # Ý à + à = 2 Ê + B © A ¿ +int(47) + +-- Iteration 3 -- +%0 %0 %0 + { … { + %0 %0 @ %0 + Ò %0 %0 %0 + %0 { %0 %0 +int(47) + +-- Iteration 4 -- +   +    +     +     +     +int(47) + +-- Iteration 5 -- +  %0 +  %0  +  %0  %0 + %0   %0 + %0    +int(47) diff --git a/tests/std/strings/vprintf_variation11.phpt b/tests/std/strings/vprintf_variation11.phpt new file mode 100644 index 00000000..2926c62a --- /dev/null +++ b/tests/std/strings/vprintf_variation11.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +37777777777 1 +int(13) + +-- Iteration 3 -- +20000000000 17777777777 20000000001 +int(35) + +-- Iteration 4 -- + 37776543211 0000 +int(38) + +-- Iteration 5 -- +111 2222 37777444445 37733333334 +int(32) + +-- Iteration 6 -- +11073 7653 123 12 +int(17) + +-- Iteration 7 -- +% %o +int(4) + +-- Iteration 8 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation11_64bit.phpt b/tests/std/strings/vprintf_variation11_64bit.phpt new file mode 100644 index 00000000..d642613b --- /dev/null +++ b/tests/std/strings/vprintf_variation11_64bit.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +1777777777777777777777 1 +int(24) + +-- Iteration 3 -- +1777777777760000000000 17777777777 1777777777760000000001 +int(57) + +-- Iteration 4 -- + 1777777777777776543211 0000 +int(49) + +-- Iteration 5 -- +111 2222 1777777777777777444445 1777777777777733333334 +int(54) + +-- Iteration 6 -- +11073 7653 123 12 +int(17) + +-- Iteration 7 -- +% %o +int(4) + +-- Iteration 8 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation12.phpt b/tests/std/strings/vprintf_variation12.phpt new file mode 100644 index 00000000..f2e4270a --- /dev/null +++ b/tests/std/strings/vprintf_variation12.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECTF-- +*** Testing vprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- + +Warning: The float 20000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 2000000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 22000000000000 is not representable as an int, cast occurred in %s on line %d +2 0 12 + 361100 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0 +int(112) + +-- Iteration 2 -- +2 37777777776 2 + 361100 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776 +int(142) + +-- Iteration 3 -- +0 0 0 + 173 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +int(84) + +-- Iteration 4 -- +1 1 1 + 1 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(71) + +-- Iteration 5 -- +1 1 0 + 1 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(71) diff --git a/tests/std/strings/vprintf_variation12_64bit.phpt b/tests/std/strings/vprintf_variation12_64bit.phpt new file mode 100644 index 00000000..e3eee126 --- /dev/null +++ b/tests/std/strings/vprintf_variation12_64bit.phpt @@ -0,0 +1,118 @@ +--TEST-- +Test vprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0 +int(149) + +-- Iteration 2 -- +2 1777777777777777777776 2 + 361100 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776 +int(201) + +-- Iteration 3 -- +0 0 0 + 173 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +int(99) + +-- Iteration 4 -- +1 1 1 + 1 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) diff --git a/tests/std/strings/vprintf_variation13.phpt b/tests/std/strings/vprintf_variation13.phpt new file mode 100644 index 00000000..952115b2 --- /dev/null +++ b/tests/std/strings/vprintf_variation13.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +ffffffff 1 22 +int(13) + +-- Iteration 3 -- +7fffffff 7000000 80000000 +int(25) + +-- Iteration 4 -- + ffed2979 0000 +int(35) + +-- Iteration 5 -- +#1 2222 1b6db bbbbbbbc +int(22) + +-- Iteration 6 -- +123b fab 0 a +int(12) + +-- Iteration 7 -- +%34 +int(3) + +-- Iteration 8 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation13_64bit.phpt b/tests/std/strings/vprintf_variation13_64bit.phpt new file mode 100644 index 00000000..881942e6 --- /dev/null +++ b/tests/std/strings/vprintf_variation13_64bit.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +ffffffffffffffff 1 22 +int(21) + +-- Iteration 3 -- +7fffffff 7000000 ffffffff80000000 +int(33) + +-- Iteration 4 -- + ffffffffffed2979 0000 +int(43) + +-- Iteration 5 -- +#1 2222 1b6db ffffffffbbbbbbbc +int(30) + +-- Iteration 6 -- +123b fab 0 a +int(12) + +-- Iteration 7 -- +%34 +int(3) + +-- Iteration 8 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation14.phpt b/tests/std/strings/vprintf_variation14.phpt new file mode 100644 index 00000000..4bda9591 --- /dev/null +++ b/tests/std/strings/vprintf_variation14.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECTF-- +*** Testing vprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- + +Warning: The float 20000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 2000000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 22000000000000 is not representable as an int, cast occurred in %s on line %d +2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0 +int(99) + +-- Iteration 2 -- +2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe +int(122) + +-- Iteration 3 -- +0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +int(80) + +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(73) + +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(73) diff --git a/tests/std/strings/vprintf_variation14_64bit.phpt b/tests/std/strings/vprintf_variation14_64bit.phpt new file mode 100644 index 00000000..91ef18a9 --- /dev/null +++ b/tests/std/strings/vprintf_variation14_64bit.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0 +int(125) + +-- Iteration 2 -- +2 fffffffffffffffe 2 + 1e240 ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe +int(164) + +-- Iteration 3 -- +0 0 0 + 7b ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +int(90) + +-- Iteration 4 -- +1 1 1 + 1 1 1 + + #1 1 $1 _1 + 1 1 1 1 +int(75) + +-- Iteration 5 -- +1 1 0 + 1 0 1 + + #0 1 $1 _0 + 0 1 1 1 +int(75) diff --git a/tests/std/strings/vprintf_variation15.phpt b/tests/std/strings/vprintf_variation15.phpt new file mode 100644 index 00000000..2eda443e --- /dev/null +++ b/tests/std/strings/vprintf_variation15.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +int(16) + +-- Iteration 2 -- + +Warning: The float 12345678900 is not representable as an int, cast occurred in %s on line %d +3755744308 1234 12345 +int(21) + +-- Iteration 3 -- + +Warning: The float 101234567000 is not representable as an int, cast occurred in %s on line %d + 1234000 2450319192 120 +int(25) + +-- Iteration 4 -- +#1 0 $0 10 +int(10) + +-- Iteration 5 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation15_64bit.phpt b/tests/std/strings/vprintf_variation15_64bit.phpt new file mode 100644 index 00000000..55e2a2c2 --- /dev/null +++ b/tests/std/strings/vprintf_variation15_64bit.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +int(16) + +-- Iteration 2 -- +12345678900 1234 12345 +int(22) + +-- Iteration 3 -- + +Warning: The float 1.0E+21 is not representable as an int, cast occurred in %s on line %d + 1234000 3875820019684212736 120 +int(34) + +-- Iteration 4 -- +#1 0 $0 10 +int(10) + +-- Iteration 5 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation16.phpt b/tests/std/strings/vprintf_variation16.phpt new file mode 100644 index 00000000..c064b7c4 --- /dev/null +++ b/tests/std/strings/vprintf_variation16.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} +?> +--EXPECTF-- +*** Testing vprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- + +Warning: The float 20000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 2000000000000 is not representable as an int, cast occurred in %s on line %d + +Warning: The float 22000000000000 is not representable as an int, cast occurred in %s on line %d +2 0 10 + 123456 123456 1234 + 2820130816 2840207360 1177509888 + 12345 12 4294967284 4294843840 + 10 123456 2 0 +int(115) + +-- Iteration 2 -- +0 0 0 + 123 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +int(84) + +-- Iteration 3 -- +1 1 1 + 1 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +int(72) + +-- Iteration 4 -- +1 1 0 + 1 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +int(72) diff --git a/tests/std/strings/vprintf_variation16_64bit.phpt b/tests/std/strings/vprintf_variation16_64bit.phpt new file mode 100644 index 00000000..9ea63998 --- /dev/null +++ b/tests/std/strings/vprintf_variation16_64bit.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test vprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 123456 1234 + 20000000000 2000000000000 22000000000000 + 12345 12 18446744073709551604 18446744073709428160 + 10 123456 2 0 +int(147) + +-- Iteration 2 -- +0 0 0 + 123 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +int(98) + +-- Iteration 3 -- +1 1 1 + 1 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +int(76) + +-- Iteration 4 -- +1 1 0 + 1 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +int(76) diff --git a/tests/std/strings/vprintf_variation17.phpt b/tests/std/strings/vprintf_variation17.phpt new file mode 100644 index 00000000..f4660fcb --- /dev/null +++ b/tests/std/strings/vprintf_variation17.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +--EXPECT-- +*** Testing vprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +0.000000e+0 +1.000000e+0 1.000000e+3 +int(36) + +-- Iteration 2 -- +2.200000e+2 1.000000e+1 1.000000e+10 +int(36) + +-- Iteration 3 -- +-2.2000e+13 1.0000e+21 1.2000e+2 +int(32) + +-- Iteration 4 -- +#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2 +int(74) + +-- Iteration 5 -- +1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3 +int(47) diff --git a/tests/std/strings/vprintf_variation18.phpt b/tests/std/strings/vprintf_variation18.phpt new file mode 100644 index 00000000..e082fbcc --- /dev/null +++ b/tests/std/strings/vprintf_variation18.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test vprintf() function : usage variations - scientific formats with non-scientific values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1 +int(233) + +-- Iteration 2 -- +0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0 +int(229) + +-- Iteration 3 -- +1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +int(228) + +-- Iteration 4 -- +1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +int(228) diff --git a/tests/std/strings/vprintf_variation19.phpt b/tests/std/strings/vprintf_variation19.phpt new file mode 100644 index 00000000..d4f30ece --- /dev/null +++ b/tests/std/strings/vprintf_variation19.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test vprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +int(13) + +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +int(29) + +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +int(29) + +-- Iteration 4 -- +1 10 11 +int(9) + +-- Iteration 5 -- +A B C +int(7) + +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +int(38) + +-- Iteration 7 -- +4294967285 22 33 +int(18) + +-- Iteration 8 -- +12 37777777755 23 +int(19) + +-- Iteration 9 -- +11 ffffffde 33 +int(16) + +-- Iteration 10 -- +11 FFFFFFDE 33 +int(16) + +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +int(38) diff --git a/tests/std/strings/vprintf_variation19_64bit.phpt b/tests/std/strings/vprintf_variation19_64bit.phpt new file mode 100644 index 00000000..672ac62e --- /dev/null +++ b/tests/std/strings/vprintf_variation19_64bit.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test vprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +int(13) + +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +int(29) + +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +int(29) + +-- Iteration 4 -- +1 10 11 +int(9) + +-- Iteration 5 -- +A B C +int(7) + +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +int(38) + +-- Iteration 7 -- +18446744073709551605 22 33 +int(28) + +-- Iteration 8 -- +12 1777777777777777777755 23 +int(30) + +-- Iteration 9 -- +11 ffffffffffffffde 33 +int(24) + +-- Iteration 10 -- +11 FFFFFFFFFFFFFFDE 33 +int(24) + +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +int(38) diff --git a/tests/std/strings/vprintf_variation2.phpt b/tests/std/strings/vprintf_variation2.phpt new file mode 100644 index 00000000..d96d108b --- /dev/null +++ b/tests/std/strings/vprintf_variation2.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test vprintf() function : usage variations - unexpected values for args argument +--SKIPIF-- + +--FILE-- +getMessage(), "\n"; + } catch (\ValueError $e) { + echo $e->getMessage(), "\n"; + } + $counter++; +}; + +// closing the resource +fclose($file_handle); + +?> +--EXPECT-- +*** Testing vprintf() : with unexpected values for args argument *** + +-- Iteration 1 -- +vprintf(): Argument #2 ($values) must be of type array, int given + +-- Iteration 2 -- +vprintf(): Argument #2 ($values) must be of type array, int given + +-- Iteration 3 -- +vprintf(): Argument #2 ($values) must be of type array, int given + +-- Iteration 4 -- +vprintf(): Argument #2 ($values) must be of type array, int given + +-- Iteration 5 -- +vprintf(): Argument #2 ($values) must be of type array, float given + +-- Iteration 6 -- +vprintf(): Argument #2 ($values) must be of type array, float given + +-- Iteration 7 -- +vprintf(): Argument #2 ($values) must be of type array, float given + +-- Iteration 8 -- +vprintf(): Argument #2 ($values) must be of type array, float given + +-- Iteration 9 -- +vprintf(): Argument #2 ($values) must be of type array, float given + +-- Iteration 10 -- +vprintf(): Argument #2 ($values) must be of type array, null given + +-- Iteration 11 -- +vprintf(): Argument #2 ($values) must be of type array, null given + +-- Iteration 12 -- +vprintf(): Argument #2 ($values) must be of type array, true given + +-- Iteration 13 -- +vprintf(): Argument #2 ($values) must be of type array, false given + +-- Iteration 14 -- +vprintf(): Argument #2 ($values) must be of type array, true given + +-- Iteration 15 -- +vprintf(): Argument #2 ($values) must be of type array, false given + +-- Iteration 16 -- +vprintf(): Argument #2 ($values) must be of type array, string given + +-- Iteration 17 -- +vprintf(): Argument #2 ($values) must be of type array, string given + +-- Iteration 18 -- +vprintf(): Argument #2 ($values) must be of type array, string given + +-- Iteration 19 -- +vprintf(): Argument #2 ($values) must be of type array, string given + +-- Iteration 20 -- +vprintf(): Argument #2 ($values) must be of type array, sample given + +-- Iteration 21 -- +vprintf(): Argument #2 ($values) must be of type array, null given + +-- Iteration 22 -- +vprintf(): Argument #2 ($values) must be of type array, null given + +-- Iteration 23 -- +vprintf(): Argument #2 ($values) must be of type array, resource given diff --git a/tests/std/strings/vprintf_variation3.phpt b/tests/std/strings/vprintf_variation3.phpt new file mode 100644 index 00000000..e6b0afab --- /dev/null +++ b/tests/std/strings/vprintf_variation3.phpt @@ -0,0 +1,84 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with int values +--FILE-- + +--EXPECT-- +*** Testing vprintf() : int formats with int values *** + +-- Iteration 1 -- +0 +int(1) + +-- Iteration 2 -- +-1 1 +int(4) + +-- Iteration 3 -- +2147483647 2147483640 -2147483640 +int(33) + +-- Iteration 4 -- + 123456 12345678 -1234567 1234567 +int(38) + +-- Iteration 5 -- +111 2222 333333 44444444 +int(24) + +-- Iteration 6 -- +4667 4011 83 10 +int(15) + +-- Iteration 7 -- +%-5678 +int(6) + +-- Iteration 8 -- +1 2 3 4 +int(7) diff --git a/tests/std/strings/vprintf_variation4.phpt b/tests/std/strings/vprintf_variation4.phpt new file mode 100644 index 00000000..96836f83 --- /dev/null +++ b/tests/std/strings/vprintf_variation4.phpt @@ -0,0 +1,105 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECTF-- +*** Testing vprintf() : int formats and non-integer values *** + +-- Iteration 1 -- + +Warning: The float 20000000000 is not representable as an int, cast occurred in %s on line %d +2 +0 10 + 123456 -1234 1234 + -1474836480 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +int(109) + +-- Iteration 2 -- +0 +0 0 + 123 -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +int(89) + +-- Iteration 3 -- +1 +1 1 + 1 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +int(78) + +-- Iteration 4 -- +1 +1 0 + 1 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +int(78) diff --git a/tests/std/strings/vprintf_variation4_64bit.phpt b/tests/std/strings/vprintf_variation4_64bit.phpt new file mode 100644 index 00000000..5631a9ad --- /dev/null +++ b/tests/std/strings/vprintf_variation4_64bit.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test vprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +int(113) + +-- Iteration 2 -- +0 +0 0 + 123 -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +int(93) + +-- Iteration 3 -- +1 +1 1 + 1 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +int(82) + +-- Iteration 4 -- +1 +1 0 + 1 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +int(82) diff --git a/tests/std/strings/vprintf_variation5.phpt b/tests/std/strings/vprintf_variation5.phpt new file mode 100644 index 00000000..b09acb78 --- /dev/null +++ b/tests/std/strings/vprintf_variation5.phpt @@ -0,0 +1,84 @@ +--TEST-- +Test vprintf() function : usage variations - float formats with float values +--FILE-- + +--EXPECT-- +*** Testing vprintf() : int formats with float values *** + +-- Iteration 1 -- +0.000000 +int(8) + +-- Iteration 2 -- +-0.100000 0.100000 10.000001 +int(28) + +-- Iteration 3 -- +2147483649.000000 2147483640.000000 -2147483640.000000 +int(54) + +-- Iteration 4 -- +200000.0000 0.0000 -200000.000000 -0.0000 +int(45) + +-- Iteration 5 -- +20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000 +int(98) + +-- Iteration 6 -- +4667.000000 4011.000000 83.000000 10.000000 +int(43) + +-- Iteration 7 -- +%-5678.567800 +int(13) + +-- Iteration 8 -- +1.110000 2.220000 3.330000 4.440000 +int(35) diff --git a/tests/std/strings/vprintf_variation6.phpt b/tests/std/strings/vprintf_variation6.phpt new file mode 100644 index 00000000..ab19f530 --- /dev/null +++ b/tests/std/strings/vprintf_variation6.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test vprintf() function : usage variations - float formats with non-float values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECT-- +*** Testing vprintf() : float formats and non-float values *** + +-- Iteration 1 -- +2.000000 -2.000000 2.000000 + 123456.000000 -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000 +int(245) + +-- Iteration 2 -- +0.000000 +0.000000 0.000000 + 123.000000 -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000 +int(197) + +-- Iteration 3 -- +1.000000 +1.000000 1.000000 + 1.000000 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000 +int(180) + +-- Iteration 4 -- +1.000000 +1.000000 0.000000 + 1.000000 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000 +int(180) diff --git a/tests/std/strings/vprintf_variation7.phpt b/tests/std/strings/vprintf_variation7.phpt new file mode 100644 index 00000000..a4dbe73c --- /dev/null +++ b/tests/std/strings/vprintf_variation7.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test vprintf() function : usage variations - string formats with strings +--FILE-- + +--EXPECTF-- +*** Testing vprintf() : string formats with strings *** + +-- Iteration 1 -- + +int(1) + +-- Iteration 2 -- +hello%0world hello%0 +int(18) + +-- Iteration 3 -- +@#$%&* UF  +int(16) + +-- Iteration 4 -- + sund mond tuesday wedn +int(34) + +-- Iteration 5 -- +This is string defined +using heredoc. abcdef 123456 3993 +4849 string __ +int(71) + +-- Iteration 6 -- +% %s +int(4) + +-- Iteration 7 -- +one two three four +int(18) diff --git a/tests/std/strings/vprintf_variation8.phpt b/tests/std/strings/vprintf_variation8.phpt new file mode 100644 index 00000000..dceef6e8 --- /dev/null +++ b/tests/std/strings/vprintf_variation8.phpt @@ -0,0 +1,140 @@ +--TEST-- +Test vprintf() function : usage variations - string formats with non-string values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + $result = vprintf($formats, $args); + echo "\n"; + var_dump($result); + $counter++; +} + +?> +--EXPECTF-- +*** Testing vprintf() : string formats and non-string values *** + +-- Iteration 1 -- +2.2 0.2 10.2 + 123456.234 -1234.6789 1234.6789 + 2123 2765 -27654321000 1234 + 12.000000011111 -12.00000111111 -123456.234 3.33 + 10.2 123456.234 2.2 0.2 +int(173) + +-- Iteration 2 -- +2 -2 2 + 123456 -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2 +int(133) + +-- Iteration 3 -- + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d + +Warning: Array to string conversion in %s on line %d +Array Array Array + Array Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array +int(132) + +-- Iteration 4 -- +1 1 + 1 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1 +int(82) diff --git a/tests/std/strings/vprintf_variation9.phpt b/tests/std/strings/vprintf_variation9.phpt new file mode 100644 index 00000000..70b28c21 --- /dev/null +++ b/tests/std/strings/vprintf_variation9.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vprintf() function : usage variations - char formats with char values +--FILE-- + +--EXPECTF-- +*** Testing vprintf() : char formats with char values *** + +-- Iteration 1 -- +%0 +int(1) + +-- Iteration 2 -- +%0 C +int(3) + +-- Iteration 3 -- +%0 ½ C +int(5) + +-- Iteration 4 -- +a Ÿ b b +int(7) + +-- Iteration 5 -- +a Ÿ b b +int(7) + +-- Iteration 6 -- +; « S + +int(7) + +-- Iteration 7 -- +%. +int(2) + +-- Iteration 8 -- +A B C D +int(7) diff --git a/tests/std/strings/vsprintf_basic1.phpt b/tests/std/strings/vsprintf_basic1.phpt new file mode 100644 index 00000000..b8dea334 --- /dev/null +++ b/tests/std/strings/vsprintf_basic1.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test vsprintf() function : basic functionality - string format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using string format *** +string(3) "one" +string(7) "one two" +string(13) "one two three" +Done diff --git a/tests/std/strings/vsprintf_basic2.phpt b/tests/std/strings/vsprintf_basic2.phpt new file mode 100644 index 00000000..86f7380d --- /dev/null +++ b/tests/std/strings/vsprintf_basic2.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test vsprintf() function : basic functionality - integer format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using integer format *** +string(3) "111" +string(7) "111 222" +string(11) "111 222 333" +Done diff --git a/tests/std/strings/vsprintf_basic3.phpt b/tests/std/strings/vsprintf_basic3.phpt new file mode 100644 index 00000000..97275193 --- /dev/null +++ b/tests/std/strings/vsprintf_basic3.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test vsprintf() function : basic functionality - float format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using float format *** +string(9) "11.110000" +string(9) "11.110000" +string(19) "11.110000 22.220000" +string(19) "11.110000 22.220000" +string(29) "11.110000 22.220000 33.330000" +string(29) "11.110000 22.220000 33.330000" +Done diff --git a/tests/std/strings/vsprintf_basic4.phpt b/tests/std/strings/vsprintf_basic4.phpt new file mode 100644 index 00000000..80482b2d --- /dev/null +++ b/tests/std/strings/vsprintf_basic4.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test vsprintf() function : basic functionality - bool format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using bool format *** +string(1) "1" +string(3) "1 0" +string(5) "1 0 1" +Done diff --git a/tests/std/strings/vsprintf_basic5.phpt b/tests/std/strings/vsprintf_basic5.phpt new file mode 100644 index 00000000..82f78b18 --- /dev/null +++ b/tests/std/strings/vsprintf_basic5.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test vsprintf() function : basic functionality - char format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using char format *** +string(1) "A" +string(3) "A B" +string(5) "A B C" +Done diff --git a/tests/std/strings/vsprintf_basic6.phpt b/tests/std/strings/vsprintf_basic6.phpt new file mode 100644 index 00000000..ae72e5af --- /dev/null +++ b/tests/std/strings/vsprintf_basic6.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test vsprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using exponential format *** +string(11) "1.000000e+3" +string(23) "1.000000e+3 2.000000e+3" +string(35) "1.000000e+3 2.000000e+3 3.000000e+3" +Done diff --git a/tests/std/strings/vsprintf_basic7.phpt b/tests/std/strings/vsprintf_basic7.phpt new file mode 100644 index 00000000..e9a3dae7 --- /dev/null +++ b/tests/std/strings/vsprintf_basic7.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(10) "4294966185" +string(21) "4294966185 4293732729" +string(32) "4294966185 4293732729 4292621864" +Done diff --git a/tests/std/strings/vsprintf_basic7_64bit.phpt b/tests/std/strings/vsprintf_basic7_64bit.phpt new file mode 100644 index 00000000..664b5174 --- /dev/null +++ b/tests/std/strings/vsprintf_basic7_64bit.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(20) "18446744073709550505" +string(41) "18446744073709550505 18446744073708317049" +string(62) "18446744073709550505 18446744073708317049 18446744073707206184" +Done diff --git a/tests/std/strings/vsprintf_basic8.phpt b/tests/std/strings/vsprintf_basic8.phpt new file mode 100644 index 00000000..6a5b01fb --- /dev/null +++ b/tests/std/strings/vsprintf_basic8.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test vsprintf() function : basic functionality - octal format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using octal format *** +string(2) "21" +string(6) "21 347" +string(10) "21 347 567" +Done diff --git a/tests/std/strings/vsprintf_basic9.phpt b/tests/std/strings/vsprintf_basic9.phpt new file mode 100644 index 00000000..30019d35 --- /dev/null +++ b/tests/std/strings/vsprintf_basic9.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test vsprintf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECT-- +*** Testing vsprintf() : basic functionality - using hexadecimal format *** +string(1) "b" +string(1) "B" +string(4) "b 84" +string(4) "B 84" +string(7) "b 84 b1" +string(7) "B 84 B1" +Done diff --git a/tests/std/strings/wordwrap.phpt b/tests/std/strings/wordwrap.phpt new file mode 100644 index 00000000..7befc013 --- /dev/null +++ b/tests/std/strings/wordwrap.phpt @@ -0,0 +1,60 @@ +--TEST-- +wordwrap() function +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; +} +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +wordwrap(): Argument #3 ($break) must not be empty diff --git a/tests/std/strings/wordwrap_basic.phpt b/tests/std/strings/wordwrap_basic.phpt new file mode 100644 index 00000000..ec40e96f --- /dev/null +++ b/tests/std/strings/wordwrap_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test wordwrap() function : basic functionality +--FILE-- +\n'; + +// Calling wordwrap() with default arguments +var_dump( wordwrap($str) ); + +// Calling wordwrap() with all possible optional arguments +// with $width arg +var_dump( wordwrap($str, $width) ); +// with $break arg +var_dump( wordwrap($str, $width, $break) ); + +// Calling wordwrap() with all arguments +// $cut as true +$width = 10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +// $cut as false +$width = 10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); +echo "Done\n"; +?> +--EXPECT-- +*** Testing wordwrap() : basic functionality *** +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(103) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
\ndoooooooooooooooooooooog." +string(178) "The quick
\nbrown
\nfooooooooo
\nox
\njummmmmmmm
\nmmmmped
\nover the
\nlazzzzzzzz
\nzzzy
\ndooooooooo
\noooooooooo
\nooog." +string(138) "The quick
\nbrown
\nfoooooooooox
\njummmmmmmmmmmmped
\nover the
\nlazzzzzzzzzzzy
\ndoooooooooooooooooooooog." +Done diff --git a/tests/std/strings/wordwrap_error.phpt b/tests/std/strings/wordwrap_error.phpt new file mode 100644 index 00000000..b93bb805 --- /dev/null +++ b/tests/std/strings/wordwrap_error.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test wordwrap() function : error conditions +--FILE-- +\n'; +$cut = true; + +// $width arg as negative value +echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; +echo "-- width = 0 & cut = false --\n"; +// width as zero and cut as false +$width = 0; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = 0 & cut = true --\n"; +// width as zero and cut as true +$width = 0; +$cut = true; + +try { + wordwrap($str, $width, $break, $cut); +} catch (\ValueError $e) { + echo $e->getMessage() . "\n"; +} + +echo "-- width = -10 & cut = false --\n"; +// width as -ne and cut as false +$width = -10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = -10 & cut = true --\n"; +// width as -ne and cut as true +$width = -10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); +?> +--EXPECT-- +*** Testing wordwrap() : error conditions *** + +-- Testing wordwrap() function with negative/zero value for width argument -- +-- width = 0 & cut = false -- +string(39) "testing
\nwordwrap
\nfunction" +-- width = 0 & cut = true -- +wordwrap(): Argument #4 ($cut_long_words) cannot be true when argument #2 ($width) is 0 +-- width = -10 & cut = false -- +string(39) "testing
\nwordwrap
\nfunction" +-- width = -10 & cut = true -- +string(223) "
\nt
\ne
\ns
\nt
\ni
\nn
\ng
\n
\nw
\no
\nr
\nd
\nw
\nr
\na
\np
\n
\nf
\nu
\nn
\nc
\nt
\ni
\no
\nn" diff --git a/tests/std/strings/wordwrap_memory_limit.phpt b/tests/std/strings/wordwrap_memory_limit.phpt new file mode 100644 index 00000000..b7c2a3ba --- /dev/null +++ b/tests/std/strings/wordwrap_memory_limit.phpt @@ -0,0 +1,18 @@ +--TEST-- +No overflow should occur during the memory_limit check for wordwrap() +--SKIPIF-- + +--INI-- +memory_limit=128M +--FILE-- + +--EXPECTF-- +Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/tests/std/strings/wordwrap_memory_limit_32bit.phpt b/tests/std/strings/wordwrap_memory_limit_32bit.phpt new file mode 100644 index 00000000..36d22cc8 --- /dev/null +++ b/tests/std/strings/wordwrap_memory_limit_32bit.phpt @@ -0,0 +1,19 @@ +--TEST-- +No overflow should occur during the memory_limit check for wordwrap() +--SKIPIF-- + +--INI-- +memory_limit=128M +--FILE-- + +--EXPECTF-- +Fatal error: %rAllowed memory size of %d bytes exhausted%s\(tried to allocate %d bytes\)|Possible integer overflow in memory allocation \(4294901777 \+ %d\)%r in %s on line %d diff --git a/tests/std/strings/wordwrap_variation5.phpt b/tests/std/strings/wordwrap_variation5.phpt new file mode 100644 index 00000000..70c97ed5 --- /dev/null +++ b/tests/std/strings/wordwrap_variation5.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test wordwrap() function : usage variations - valid break arguments(spaces) +--FILE-- + +--EXPECT-- +*** Testing wordwrap() : usage variations *** + +-- Testing wordwrap() with default break value and single space as value -- +-- with default break and cut value -- +string(24) "Testing +wordrap +function" +-- with default cut value -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as false -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as true -- +string(43) "T e s t i n g w o r d r a p f u n c t i o n" +string(64) "T e s t i n g w o r d r a p f u n c t i o n" +Done