diff options
Diffstat (limited to 'ext/standard/tests/strings')
84 files changed, 202 insertions, 910 deletions
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex 4080c7214d..5b60f6168d 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index 6b8d10daa7..f31f94fd84 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -2,9 +2,11 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion --FILE-- <?php -var_dump( -get_html_translation_table(NAN, 0, "UTF-8") > 0 -); ---EXPECTF-- -Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d -bool(false) +try { + var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table() expects parameter 1 to be int, float given diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt index d5fb974559..7f089ac5b5 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt @@ -11,11 +11,19 @@ Test chr() function : error conditions echo "*** Testing chr() : error conditions ***\n"; echo "\n-- Testing chr() function with no arguments --\n"; -var_dump( chr() ); +try { + var_dump( chr() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing chr() function with more than expected no. of arguments --\n"; $extra_arg = 10; -var_dump( chr(72, $extra_arg) ); +try { + var_dump( chr(72, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== @@ -23,12 +31,8 @@ var_dump( chr(72, $extra_arg) ); *** Testing chr() : error conditions *** -- Testing chr() function with no arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() -- Testing chr() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() ===DONE=== diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt Binary files differindex be0b1a32da..43e31a20f3 100644 --- a/ext/standard/tests/strings/chr_ord.phpt +++ b/ext/standard/tests/strings/chr_ord.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt Binary files differindex 8a5a8cd6bb..8650f2cb92 100644 --- a/ext/standard/tests/strings/chunk_split_variation5.phpt +++ b/ext/standard/tests/strings/chunk_split_variation5.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index bfafd1af0b..9804ee21e1 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -46,7 +46,11 @@ $values = array ( // loop through each element of values for 'chunklen' for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count+1). " --\n"; - var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + try { + var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done" @@ -82,9 +86,7 @@ string(129) "This's heredoc string with and It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL +chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index af239543c5..a1473ad316 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -3,11 +3,7 @@ basic convert_cyr_string() tests --FILE-- <?php -var_dump(convert_cyr_string()); -var_dump(convert_cyr_string("")); -var_dump(convert_cyr_string("", "")); var_dump(convert_cyr_string("", "", "")); -var_dump(convert_cyr_string(array(), array(), array())); var_dump(convert_cyr_string("[[[[[[", "q", "m")); var_dump(convert_cyr_string("[[[[[[", "k", "w")); @@ -20,23 +16,11 @@ var_dump(convert_cyr_string("", "d", "i")); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: in %s on line %d Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d string(0) "" -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d string(6) "[[[[[[" string(6) "[[[[[[" diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt index 66effea430..6ac438efaf 100644 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -15,15 +15,6 @@ $extra_arg = 10; echo "*** Testing convert_cyr_string() : error conditions ***\n"; -echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; -var_dump( convert_cyr_string() ); - -echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; -var_dump( convert_cyr_string($str, $from) ); - -echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; -var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); - echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); @@ -38,21 +29,6 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); --EXPECTF-- *** Testing convert_cyr_string() : error conditions *** --- Testing convert_cyr_string() function with no arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with no 'to' character set -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with more than expected no. of arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing convert_cyr_string() function with invalid 'from' character set -- Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index f64b61cb5f..270f0372d1 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n"; var_dump(crypt($str)); -var_dump(crypt()); -var_dump(crypt("", "", "")); ?> --EXPECTF-- @@ -31,9 +29,3 @@ BLO Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d string(%d) "%s" - -Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt index 98a9ea5b45..79fac30029 100644 --- a/ext/standard/tests/strings/dirname_error.phpt +++ b/ext/standard/tests/strings/dirname_error.phpt @@ -6,26 +6,15 @@ Test dirname() function : error conditions Description: Returns directory name component of path. */ echo "*** Testing error conditions ***\n"; -// zero arguments -var_dump( dirname() ); // Bad arg var_dump( dirname("/var/tmp/bar.gz", 0) ); -// more than expected no. of arguments -var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") ); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d NULL - -Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 6842947605..de3049a47b 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -77,11 +77,6 @@ class string1 { $obj = new string1; var_dump( explode("b", $obj) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for arguments <2 and >3 */ -var_dump( explode(":", "array1:array2:array3", -1, -33) ); -var_dump( explode(":") ); - echo "Done\n"; ?> --EXPECTF-- @@ -498,12 +493,4 @@ array(2) { [1]=> string(4) "ject" } - -*** Testing error conditions *** - -Warning: explode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: explode() expects at least 2 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index ccc37407e8..1ffc188051 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -7,25 +7,31 @@ Test fprintf() function (errors) echo "*** Testing Error Conditions ***\n"; /* zero argument */ -var_dump( fprintf() ); +try { + var_dump( fprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* scalar argument */ -var_dump( fprintf(3) ); +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* NULL argument */ -var_dump( fprintf(NULL) ); +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt index 65636908e6..10ea752291 100644 --- a/ext/standard/tests/strings/highlight_file.phpt +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -13,7 +13,6 @@ allow_url_fopen=1 $filename = dirname(__FILE__)."/highlight_file.dat"; -var_dump(highlight_file()); var_dump(highlight_file($filename)); var_dump(highlight_file('data:,<?php echo "test"; ?>')); @@ -37,9 +36,6 @@ var_dump(highlight_file($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - 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 diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 5a023df701..f2abfd5ba8 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) ); var_dump( htmlentities($str, ENT_NOQUOTES) ); var_dump( htmlentities($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlentities() ); -/* arguments more than expected */ -var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") ); - echo "Done\n"; ?> --EXPECTF-- @@ -320,10 +314,4 @@ string(36) "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>" - -*** Testing error conditions *** - -Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(14) "„‘" Done diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 8506c73e72..6e5c5fac36 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) ); var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); var_dump( htmlspecialchars($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlspecialchars() ); - -/* giving arguments more than expected */ -var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") ); - echo "Done\n" ?> --EXPECTF-- @@ -321,10 +314,4 @@ string(36) "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>" - -*** Testing error conditions *** - -Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(10) "<br>" Done diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex d5de391e96..9d9afc6f3c 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt index 36ee9d7ba6..832fb58c05 100644 --- a/ext/standard/tests/strings/join_error.phpt +++ b/ext/standard/tests/strings/join_error.phpt @@ -10,18 +10,6 @@ Test join() function: error conditions echo "*** Testing join() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing join() function with Zero arguments --\n"; -var_dump( join() ); - -// More than expected number of arguments -echo "\n-- Testing join() function with more than expected no. of arguments --\n"; -$glue = 'string_val'; -$pieces = array(1, 2); -$extra_arg = 10; - -var_dump( join($glue, $pieces, $extra_arg) ); - // Less than expected number of arguments echo "\n-- Testing join() with less than expected no. of arguments --\n"; $glue = 'string_val'; @@ -33,16 +21,6 @@ echo "Done\n"; --EXPECTF-- *** Testing join() : error conditions *** --- Testing join() function with Zero arguments -- - -Warning: join() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing join() function with more than expected no. of arguments -- - -Warning: join() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing join() with less than expected no. of arguments -- Warning: join(): Argument must be an array in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 97dfc4153b..38cb7e566f 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt index 1ac05cf2ae..b4b7c03e7f 100644 --- a/ext/standard/tests/strings/levenshtein.phpt +++ b/ext/standard/tests/strings/levenshtein.phpt @@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl echo ($n==0)?"all passed\n":"$n failed\n"; -var_dump(levenshtein(array(), array())); var_dump(levenshtein("", "", -1, -1, -1)); var_dump(levenshtein("", "", 10, 10, 10)); -var_dump(levenshtein("")); ?> --EXPECTF-- @@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d Warning: levenshtein(): Argument string(s) too long in %s on line %d all passed - -Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d -NULL int(0) int(0) - -Warning: Wrong parameter count for levenshtein() in %s on line %d -NULL diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 638c93557f..51287e04d7 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -9,12 +9,6 @@ Test ltrim() function echo "\n *** Output for Error Conditions ***\n"; - echo "\n *** Output for zero argument ***\n"; - var_dump( ltrim() ); - - echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n"; - var_dump( ltrim("", " ", 1) ); - /* heredoc string */ $str = <<<EOD us @@ -50,16 +44,6 @@ echo "\nDone\n"; --EXPECTF-- *** Output for Error Conditions *** - *** Output for zero argument *** - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - - *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - *** Using heredoc string *** string(17) "ng heredoc string" diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt index 694d9fea18..58324d7f3a 100644 --- a/ext/standard/tests/strings/ltrim_error.phpt +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -11,14 +11,6 @@ Test ltrim() function : error conditions echo "*** Testing ltrim() : error conditions ***\n"; -echo "\n-- Testing ltrim() function with no arguments --\n"; -var_dump( ltrim() ); - -echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( ltrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test ltrim function with various invalid charlists\n"; var_dump(ltrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c")); --EXPECTF-- *** Testing ltrim() : error conditions *** --- Testing ltrim() function with no arguments -- - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing ltrim() function with more than expected no. of arguments -- - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test ltrim function with various invalid charlists Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 45009669f4..e56987cd6a 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index ef1d23d89a..c70b4846a1 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -3,7 +3,6 @@ metaphone() tests --FILE-- <?php -var_dump(metaphone()); var_dump(metaphone("")); var_dump(metaphone(-1)); var_dump(metaphone(-1, -1)); @@ -26,8 +25,6 @@ foreach($array as $str) { echo "Done\n"; ?> --EXPECTF-- -Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d -NULL string(0) "" string(0) "" bool(false) diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt index 454b593537..8a4366f1bb 100644 --- a/ext/standard/tests/strings/money_format_error.phpt +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -23,15 +23,6 @@ $extra_arg = 10; echo "*** Testing money_format() : error conditions ***\n"; -echo "\n-- Testing money_format() function with no arguments --\n"; -var_dump( money_format() ); - -echo "\n-- Testing money_format() function with insufficient arguments --\n"; -var_dump( money_format($string) ); - -echo "\n-- Testing money_format() function with more than expected no. of arguments --\n"; -var_dump( money_format($string, $value, $extra_arg) ); - echo "\n-- Testing money_format() function with more than one token --\n"; var_dump( money_format($string . $string, $value) ); ?> @@ -39,21 +30,6 @@ var_dump( money_format($string . $string, $value) ); --EXPECTF-- *** Testing money_format() : error conditions *** --- Testing money_format() function with no arguments -- - -Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing money_format() function with insufficient arguments -- - -Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing money_format() function with more than expected no. of arguments -- - -Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing money_format() function with more than one token -- Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt index a3d735069d..2bbea73588 100644 --- a/ext/standard/tests/strings/pathinfo.phpt +++ b/ext/standard/tests/strings/pathinfo.phpt @@ -3,7 +3,6 @@ pathinfo() tests --FILE-- <?php -var_dump(pathinfo()); var_dump(pathinfo("")); var_dump(pathinfo(".")); var_dump(pathinfo("..")); @@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME)); echo "Done\n"; ?> --EXPECTF-- -Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d -NULL array(2) { ["basename"]=> string(0) "" diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index d9376b101a..caab3bc1d2 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -5,7 +5,6 @@ php_strip_whitespace() tests $filename = dirname(__FILE__)."/php_strip_whitespace.dat"; -var_dump(php_strip_whitespace()); var_dump(php_strip_whitespace($filename)); $data = '/* test comment */'; @@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - 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 */" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index eab44a4a65..89b1b9ace2 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least %d parameter, %d given in %s on line %d +printf() expects at least %d parameter, %d given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 1a90970371..0106f71445 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d +printf() expects at least 1 parameter, 0 given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index a88390bc04..aff95426e6 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing printf() function with Zero arguments --\n"; -var_dump( printf() ); +try { + var_dump( printf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ var_dump( printf($format3) ); *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +printf() expects at least 1 parameter, 0 given -- Testing printf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index 1ce7d791dc..df26d5cf4b 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1 --FILE-- <?php -var_dump(quoted_printable_encode()); var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode("test", "more")); -$a = array("str"); -var_dump(quoted_printable_encode($a)); var_dump(quoted_printable_encode(1)); var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; ?> ---EXPECTF-- -Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- string(0) "" string(4) "test" - -Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d -NULL string(1) "1" string(0) "" string(0) "" diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 5f57b0e850..223a839f58 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt index 108f96a1f0..210fb58c4e 100644 --- a/ext/standard/tests/strings/rtrim_error.phpt +++ b/ext/standard/tests/strings/rtrim_error.phpt @@ -11,14 +11,6 @@ Test rtrim() function : error conditions echo "*** Testing rtrim() : error conditions ***\n"; -echo "\n-- Testing rtrim() function with no arguments --\n"; -var_dump( rtrim() ); - -echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( rtrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test rtrim function with various invalid charlists\n"; var_dump(rtrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c")); --EXPECTF-- *** Testing rtrim() : error conditions *** --- Testing rtrim() function with no arguments -- - -Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing rtrim() function with more than expected no. of arguments -- - -Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test rtrim function with various invalid charlists Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt index 14bb7d7ed5..c2b18b1992 100644 --- a/ext/standard/tests/strings/setlocale_error.phpt +++ b/ext/standard/tests/strings/setlocale_error.phpt @@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing setlocale() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing setlocale() function with Zero arguments --"; -var_dump( setlocale()); - -// One argument -echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; -var_dump( setlocale(LC_ALL) ); - echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; //Invalid array of locales $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); @@ -44,14 +36,6 @@ echo "\nDone"; --EXPECTF-- *** Testing setlocale() : error conditions *** --- Testing setlocale() function with Zero arguments -- -Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing setlocale() function with One argument, 'category' = LC_ALL -- -Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- bool(false) diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 102dab75ff..09e81be014 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -46,12 +46,6 @@ var_dump( sha1_file(12) ); echo "\n-- NULL as filename --\n"; var_dump( sha1_file(NULL) ); -echo "\n-- Zero arguments --\n"; - var_dump ( sha1_file() ); - -echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); - echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; var_dump( sha1_file("EmptyFileSHA1.txt") ); @@ -95,16 +89,6 @@ bool(false) Warning: sha1_file(): Filename cannot be empty in %s on line %d bool(false) --- Zero arguments -- - -Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- More than valid number of arguments ( valid is 2) -- - -Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Hexadecimal Output for Empty file as Argument -- string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 650236c2e5..744f71c17a 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -5,7 +5,6 @@ soundex() tests var_dump(soundex("")); var_dump(soundex(-1)); -var_dump(soundex(array())); $array = array( "From", @@ -34,9 +33,6 @@ echo "Done\n"; --EXPECTF-- bool(false) string(4) "0000" - -Warning: soundex() expects parameter 1 to be string, array given in %s on line %d -NULL string(4) "F650" string(4) "T300" string(4) "T500" diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 1c12cd3168..1b21b8b141 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing sprintf() function with Zero arguments --\n"; -var_dump( sprintf() ); +try { + var_dump( sprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ echo "Done"; *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- - -Warning: sprintf() expects at least %d parameter, %d given in %s on line %d -bool(false) +sprintf() expects at least %d parameter, %d given -- Testing sprintf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt index ca967758ab..3e54a42f1e 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/sscanf_error.phpt @@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n"; $str = "Hello World"; $format = "%s %s"; -echo "\n-- Testing sscanf() function with no arguments --\n"; -var_dump( sscanf() ); - -echo "\n-- Testing sscanf() function with one argument --\n"; -var_dump( sscanf($str) ); - echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n"; var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); @@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); --EXPECTF-- *** Testing sscanf() : error conditions *** --- Testing sscanf() function with no arguments -- - -Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing sscanf() function with one argument -- - -Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing sscanf() function with more than expected no. of arguments -- Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt index 526b8ac723..71a9d1e127 100644 --- a/ext/standard/tests/strings/str_ireplace.phpt +++ b/ext/standard/tests/strings/str_ireplace.phpt @@ -3,9 +3,6 @@ str_ireplace() tests --FILE-- <?php -var_dump(str_ireplace()); -var_dump(str_ireplace("")); -var_dump(str_ireplace("", "")); var_dump(str_ireplace("", "", "")); var_dump(str_ireplace("tt", "a", "ttttTttttttttTT")); @@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data)); echo "Done\n"; ?> --EXPECTF-- -Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d -NULL string(0) "" string(8) "aaaaaaaT" string(8) "aaaaaaaT" diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt Binary files differindex b44a9517ab..be4c9ed942 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 306b7d381a..766bea1f9c 100644 --- a/ext/standard/tests/strings/str_repeat.phpt +++ b/ext/standard/tests/strings/str_repeat.phpt diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt index 7b411abac5..bef11f872a 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") ); var_dump( str_replace("worldS", "FOUND", "${str}S") ); var_dump( str_replace("worldS", "FOUND", "{$str}S") ); - -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump( str_replace() ); -var_dump( str_replace("") ); -var_dump( str_replace(NULL) ); -var_dump( str_replace(1, 2) ); -var_dump( str_replace(1,2,3,$var,5) ); - fclose($resource1); closedir($resource2); echo "Done\n"; @@ -938,20 +929,4 @@ Notice: Undefined variable: strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND" - -*** Testing error conditions *** -Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index a477800a26..1aea668026 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -30,7 +30,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -157,10 +156,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 5082c7ba2f..1a2471a20a 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -32,7 +32,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -135,10 +134,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index f88646370b..e8fa12aca6 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -13,28 +13,20 @@ var_dump(str_word_count($str, 3)); var_dump(str_word_count($str, 123)); var_dump(str_word_count($str, -1)); var_dump(str_word_count($str, 999999999)); -var_dump(str_word_count($str, array())); -var_dump(str_word_count($str, $b)); var_dump($str); $str2 = "F0o B4r 1s bar foo"; var_dump(str_word_count($str2, NULL, "04")); var_dump(str_word_count($str2, NULL, "01")); var_dump(str_word_count($str2, NULL, "014")); -var_dump(str_word_count($str2, NULL, array())); -var_dump(str_word_count($str2, NULL, new stdClass)); var_dump(str_word_count($str2, NULL, "")); 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, array())); -var_dump(str_word_count($str2, 1, new stdClass)); 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, array())); -var_dump(str_word_count($str2, 2, new stdClass)); 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)); @@ -86,23 +78,11 @@ bool(false) Warning: str_word_count(): Invalid format value 999999999 in %s on line %d bool(false) - -Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d -NULL string(55) "Hello friend, you're looking good today!" int(5) int(6) int(5) - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL int(7) array(5) { [0]=> @@ -142,12 +122,6 @@ array(5) { [4]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -202,12 +176,6 @@ array(5) { [15]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 3086c2be92..d9063cc9de 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex 397e072c52..fd20e50195 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index 324014cf6d..0420bb090b 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -8,14 +8,6 @@ Test stripos() function : error conditions */ echo "*** Testing stripos() function: error conditions ***\n"; -echo "\n-- With Zero arguments --"; -var_dump( stripos() ); - -echo "\n-- With less than expected number of arguments --"; -var_dump( stripos("String") ); - -echo "\n-- With more than expected number of arguments --"; -var_dump( stripos("string", "String", 1, 'extra_arg') ); echo "\n-- Offset beyond the end of the string --"; var_dump( stripos("Hello World", "o", 12) ); @@ -28,18 +20,6 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: error conditions *** --- With Zero arguments -- -Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- With less than expected number of arguments -- -Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- With more than expected number of arguments -- -Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Offset beyond the end of the string -- Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81d3b35a20..6792b4d0b2 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needles[$index]) ); + try { + var_dump( stripos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -122,29 +126,19 @@ bool(false) int(17) -- Iteration 10 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 2 to be string, array given in %s on line %d -NULL +stripos() expects parameter 2 to be string, array given -- Iteration 15 -- int(9) @@ -174,9 +168,7 @@ bool(false) bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 2 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index 1f79b61d1a..aab3181df3 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( stripos($values[$index], $values[$index]) ); - var_dump( stripos($values[$index], $values[$index], 1) ); + try { + var_dump( stripos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( stripos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -118,40 +126,20 @@ bool(false) int(0) bool(false) -- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 15 -- int(0) bool(false) @@ -192,12 +180,8 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 1 to be string, resource given +stripos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index a0f0cc3497..92cfa09eb1 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,10 +2,6 @@ stristr() function --FILE-- <?php - var_dump(stristr()); - var_dump(stristr(array(), "")); - var_dump(stristr("", array())); - var_dump(stristr(array(), array())); var_dump(stristr("tEsT sTrInG", "tEsT")); var_dump(stristr("tEsT sTrInG", "stRiNg")); var_dump(stristr("tEsT sTrInG", "stRiN")); @@ -19,17 +15,6 @@ stristr() function var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL string(11) "tEsT sTrInG" string(6) "sTrInG" string(6) "sTrInG" diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt index a0057574f9..a7b683d3b8 100644 --- a/ext/standard/tests/strings/stristr_error.phpt +++ b/ext/standard/tests/strings/stristr_error.phpt @@ -8,17 +8,6 @@ Test stristr() function : error conditions */ echo "*** Testing stristr() : error conditions ***\n"; -echo "\n-- Testing stristr() function with no arguments --\n"; -var_dump( stristr() ); -var_dump( stristr("") ); - -echo "\n-- Testing stristr() function with no needle --\n"; -var_dump( stristr("Hello World") ); // without "needle" - -echo "\n-- Testing stristr() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( stristr("Hello World", "World", true, $extra_arg) ); - echo "\n-- Testing stristr() function with empty haystack --\n"; var_dump( stristr(NULL, "") ); @@ -30,24 +19,6 @@ var_dump( stristr("Hello World", "") ); --EXPECTF-- *** Testing stristr() : error conditions *** --- Testing stristr() function with no arguments -- - -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with no needle -- - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with more than expected no. of arguments -- - -Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing stristr() function with empty haystack -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 8ca09db66c..fd842d1106 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -72,7 +72,11 @@ $pad_length = "20"; $count = 1; foreach($inputs as $input) { echo "-- Iteration $count --\n"; - var_dump( stristr("Hello World", $input) ); + try { + var_dump( stristr("Hello World", $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -97,17 +101,11 @@ bool(false) -- Iteration 7 -- bool(false) -- Iteration 8 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 9 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 10 -- - -Warning: stristr() expects parameter 2 to be string, array given in %s on line %d -NULL +stristr() expects parameter 2 to be string, array given -- Iteration 11 -- bool(false) -- Iteration 12 -- @@ -131,9 +129,7 @@ bool(false) -- Iteration 17 -- bool(false) -- Iteration 18 -- - -Warning: stristr() expects parameter 2 to be string, resource given in %s on line %d -NULL +stristr() expects parameter 2 to be string, resource given -- Iteration 19 -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex a546bdb8d2..156038ed7b 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt index d443f8113b..00ddfaed9b 100644 --- a/ext/standard/tests/strings/strncasecmp_error.phpt +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions echo "*** Testing strncasecmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -echo "\n-- Testing strncasecmp() function with Zero arguments --"; -var_dump( strncasecmp() ); - -echo "\n-- Testing strncasecmp() function with less than expected number of arguments --"; -var_dump( strncasecmp($str1) ); -var_dump( strncasecmp($str1, $str2) ); - -echo "\n-- Testing strncasecmp() function with more than expected number of arguments --"; -var_dump( strncasecmp($str1, $str2, $len, $extra_arg) ); echo "\n-- Testing strncasecmp() function with invalid argument --"; $len = -10; @@ -31,21 +19,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncasecmp() function: error conditions *** --- Testing strncasecmp() function with Zero arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing strncasecmp() function with less than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing strncasecmp() function with more than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing strncasecmp() function with invalid argument -- Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt index 4eb73eb318..13a4cb0350 100644 --- a/ext/standard/tests/strings/strncmp_error.phpt +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -12,13 +12,6 @@ Test strncmp() function : error conditions echo "*** Testing strncmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -var_dump( strncmp() ); //Zero argument -var_dump( strncmp($str1) ); //One argument, less than expected no. of args -var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args -var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args /* Invalid argument for $len */ $len = -10; @@ -28,18 +21,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncmp() function: error conditions *** -Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt index 658e2f429e..cce843c2f1 100644 --- a/ext/standard/tests/strings/strpbrk_error.phpt +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -11,47 +11,17 @@ Test strpbrk() function : error conditions echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; -$char_list = 'string_val'; -$extra_arg = 10; - -echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; -var_dump( strpbrk($haystack, $char_list, $extra_arg) ); - -echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; -var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); -echo "\n-- Testing strpbrk() function with arrays --\n"; -var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); -var_dump( strpbrk(array('foo', 'bar'), 'b') ); - ?> ===DONE=== --EXPECTF-- *** Testing strpbrk() : error conditions *** --- Testing strpbrk() function with more than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing strpbrk() function with less than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing strpbrk() function with empty second argument -- Warning: strpbrk(): The character list cannot be empty in %s on line %d bool(false) - --- Testing strpbrk() function with arrays -- - -Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d -bool(false) - -Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex a4c3a9c781..4640b670f3 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 478ac80300..1004a3d915 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -121,7 +121,11 @@ $needles = array ( $count = 1; for($index = 0; $index < count($haystacks); $index++) { echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); + try { + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -129,7 +133,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- string(1) "0" @@ -150,25 +154,15 @@ string(2) "10" -- Iteration 9 -- bool(false) -- Iteration 10 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, array given -- Iteration 15 -- bool(false) -- Iteration 16 -- @@ -188,9 +182,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 2 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 92a9c07eee..79ffe4c2ec 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -80,7 +80,11 @@ $values = array ( $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrchr($values[$index], $values[$index]) ); + try { + var_dump( strrchr($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -88,7 +92,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- string(1) "0" @@ -109,25 +113,15 @@ string(4) "1E-9" -- Iteration 9 -- string(3) "0.5" -- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 15 -- string(1) "1" -- Iteration 16 -- @@ -147,9 +141,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index 291ff78cd7..fa15e2fcac 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -15,9 +15,6 @@ strripos() function var_dump(@strripos("a", "")); var_dump(@strripos("", "a")); var_dump(@strripos("\\\\a", "\\a")); - - $fp = fopen(__FILE__, "r"); - var_dump(@strripos("", $fp)); ?> --EXPECT-- int(5) @@ -33,4 +30,3 @@ bool(false) bool(false) bool(false) int(1) -bool(false) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index b5d09d7946..5981c9b6cb 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -3,11 +3,12 @@ strripos() offset integer overflow --FILE-- <?php -var_dump(strripos("t", "t", PHP_INT_MAX+1)); -var_dump(strripos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strripos(100, 101, PHP_INT_MAX+1)); -var_dump(strripos(1024, 1024, PHP_INT_MAX+1)); -var_dump(strripos(array(), array(), PHP_INT_MAX+1)); +try { + var_dump(strripos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strripos(1024, 1024, -PHP_INT_MAX)); var_dump(strripos(1024, "te", -PHP_INT_MAX)); var_dump(strripos(1024, 1024, -PHP_INT_MAX-1)); @@ -16,20 +17,7 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strripos() expects parameter 3 to be int, float given Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 1399b60985..d1bbc856a3 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -3,10 +3,12 @@ strrpos() offset integer overflow --FILE-- <?php -var_dump(strrpos("t", "t", PHP_INT_MAX+1)); -var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strrpos(100, 101, PHP_INT_MAX+1)); -var_dump(strrpos(1024, 1024, PHP_INT_MAX+1)); +try { + var_dump(strrpos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strrpos(1024, 1024, -PHP_INT_MAX)); var_dump(strrpos(1024, "te", -PHP_INT_MAX)); var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1)); @@ -15,17 +17,7 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) +strrpos() expects parameter 3 to be int, float given Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b374e7f9f6..440605d430 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needles[$index]) ); + try { + var_dump( strrpos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,7 +95,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- int(42) @@ -112,25 +116,15 @@ bool(false) -- Iteration 9 -- int(28) -- Iteration 10 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 15 -- int(41) -- Iteration 16 -- @@ -150,9 +144,7 @@ bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 2 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, resource given -- Iteration 25 -- bool(false) -- Iteration 26 -- diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index f628427f08..71201a1c21 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -81,14 +81,22 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( strrpos($values[$index], $values[$index]) ); - var_dump( strrpos($values[$index], $values[$index], 1) ); + try { + var_dump( strrpos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( strrpos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- int(0) @@ -118,40 +126,20 @@ bool(false) int(0) bool(false) -- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 15 -- int(0) bool(false) @@ -180,12 +168,8 @@ bool(false) bool(false) bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, resource given +strrpos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) bool(false) diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex cc3b7c5453..6bdc3feab1 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt Binary files differindex c0ad1d0115..ff631754df 100644 --- a/ext/standard/tests/strings/strtolower-win32.phpt +++ b/ext/standard/tests/strings/strtolower-win32.phpt diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex 47dfe09762..7c7e2bb4c7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt Binary files differindex 60701652e1..7240e5c021 100644 --- a/ext/standard/tests/strings/strtoupper1-win32.phpt +++ b/ext/standard/tests/strings/strtoupper1-win32.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex e0ebf42ea7..c243ff10c7 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 37ecfd14d5..acf3cc623a 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -16,17 +16,6 @@ class MyClass // no toString() method defined } -$string = "Hello"; -$extra_arg = 10; - -//Test strval with one more than the expected number of arguments -echo "\n-- Testing strval() function with more than expected no. of arguments --\n"; -var_dump( strval($string, $extra_arg) ); - -// Testing strval with one less than the expected number of arguments -echo "\n-- Testing strval() function with less than expected no. of arguments --\n"; -var_dump( strval() ); - // Testing strval with a object which has no toString() method echo "\n-- Testing strval() function with object which has not toString() method --\n"; var_dump( strval(new MyClass()) ); @@ -36,16 +25,6 @@ var_dump( strval(new MyClass()) ); --EXPECTF-- *** Testing strval() : error conditions *** --- Testing strval() function with more than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing strval() function with less than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -- Testing strval() function with object which has not toString() method -- Recoverable fatal error: Object of class MyClass could not be converted to string in %s on line %d diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 0901d2082e..18e7cd1781 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 1fdf1b144f..2e3256631c 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -12,11 +12,9 @@ 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)); -var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass)); echo "Test\n"; var_dump(substr_compare("abcde", "abc", 0, -1)); var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); -var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> @@ -32,15 +30,9 @@ Warning: substr_compare(): The start position cannot exceed initial string lengt bool(false) bool(true) int(0) - -Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d -bool(false) Test Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d bool(false) bool(true) - -Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index eecc251e6c..246963d13b 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -6,12 +6,6 @@ Test substr_count() function (error conditions) echo "\n*** Testing error conditions ***\n"; $str = 'abcdefghik'; -/* Zero argument */ -var_dump( substr_count() ); - -/* more than expected no. of args */ -var_dump( substr_count($str, "t", 0, 15, 30) ); - /* offset before start */ var_dump(substr_count($str, "t", -20)); @@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25)); Warning message expected, as length+offset > length of string */ var_dump( substr_count($str, "i", 5, 7) ); -/* Invalid offset argument */ -var_dump( substr_count($str, "t", "") ); - /* length too small */ var_dump( substr_count($str, "t", 2, -20) ); @@ -34,12 +25,6 @@ echo "Done\n"; --EXPECTF-- *** Testing error conditions *** -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) @@ -49,9 +34,6 @@ bool(false) Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d -NULL - Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index 71f2d223e1..19a9a0310d 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") ); var_dump( substr_count($str, "i", "5t", "10t") ); echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "t", "") ); -var_dump( substr_count($str, "T", "") ); -var_dump( substr_count($str, "t", "", 15) ); var_dump( substr_count($str, "I", NULL) ); var_dump( substr_count($str, "i", NULL, 10) ); @@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d int(2) -- 3rd or 4th arg as NULL -- - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL int(0) int(2) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index ac945349fe..936d0fd1d5 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n"; $s1 = "Good morning"; -echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n"; -var_dump(substr_replace()); -var_dump(substr_replace($s1, "evening")); - -echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n"; -var_dump(substr_replace($s1, "evening", 5, 7, true)); - echo "\n-- Testing substr_replace() function with start and length different types --\n"; var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); @@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8))); --EXPECTF-- *** Testing substr_replace() : error conditions *** --- Testing substr_replace() function with less than expected no. of arguments -- - -Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing substr_replace() function with more than expected no. of arguments -- - -Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing substr_replace() function with start and length different types -- Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex d0e4070d80..1ad504c61d 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt index b845cee1ac..046a2b04f9 100644 --- a/ext/standard/tests/strings/trim_error.phpt +++ b/ext/standard/tests/strings/trim_error.phpt @@ -11,14 +11,6 @@ Test trim() function : error conditions echo "*** Testing trim() : error conditions ***\n"; -echo "\n-- Testing trim() function with no arguments --\n"; -var_dump( trim() ); - -echo "\n-- Testing trim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( trim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test trim function with various invalid charlists --\n"; var_dump(trim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c")); --EXPECTF-- *** Testing trim() : error conditions *** --- Testing trim() function with no arguments -- - -Warning: trim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing trim() function with more than expected no. of arguments -- - -Warning: trim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test trim function with various invalid charlists -- Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex 0b177a8565..3508881d3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index f04e493772..b34be23267 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -10,13 +10,6 @@ Test unpack() function : error conditions echo "*** Testing unpack() : error conditions ***\n"; -echo "\n-- Testing unpack() function with no arguments --\n"; -var_dump( unpack() ); - -echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); - echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; var_dump(unpack("B", pack("I", 65534))); @@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534))); --EXPECTF-- *** Testing unpack() : error conditions *** --- Testing unpack() function with no arguments -- - -Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing unpack() function with more than expected no. of arguments -- - -Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing unpack() function with invalid format character -- Warning: unpack(): Invalid format type B in %s on line %d diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt index 5a1f3d2a24..8199a2ed05 100644 --- a/ext/standard/tests/strings/uuencode.phpt +++ b/ext/standard/tests/strings/uuencode.phpt @@ -3,9 +3,6 @@ uuencode family tests --FILE-- <?php -var_dump(convert_uuencode(array())); -var_dump(convert_uudecode(array())); - var_dump(convert_uuencode("")); var_dump(convert_uudecode("")); var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ")); @@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10))); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) bool(false) bool(false) string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c56631ecd7..b4548e8b49 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments $format = 'string_val'; $args = array( 1, 2 ); $extra_arg = 10; -var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); -var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +try { + var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Close handle fclose($fp); @@ -37,10 +45,6 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL +Wrong parameter count for vfprintf() +Wrong parameter count for vfprintf() ===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 2865d42a9e..e54e34f4cd 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; -var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +try { + var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); // Close handle @@ -34,9 +38,7 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with other strangeties -- - -Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +vfprintf() expects parameter 1 to be resource, string given Warning: vfprintf(): Argument number must be greater than zero in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 76422011c2..7c969ffff9 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -48,8 +48,6 @@ 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 ) ); -@writeAndDump( $funset, "Foo with %s", array( 'string' ) ); -@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) ); // Close handle fclose( $fp ); @@ -79,8 +77,4 @@ string(0) "" int(0) string(38) "Testing 1001 6 2.550200 30 foobar f 41" int(38) -bool(false) -bool(false) -bool(false) -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt index 41c5cbdb69..ad75461d3d 100644 --- a/ext/standard/tests/strings/wordwrap_error.phpt +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -9,19 +9,10 @@ Test wordwrap() function : error conditions echo "*** Testing wordwrap() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing wordwrap() function with Zero arguments --\n"; -var_dump( wordwrap() ); - -// More than expected number of arguments -echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n"; $str = 'testing wordwrap function'; $width = 10; $break = '<br />\n'; $cut = true; -$extra_arg = "extra_arg"; - -var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); // $width arg as negative value echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; @@ -54,16 +45,6 @@ echo "Done\n"; --EXPECTF-- *** Testing wordwrap() : error conditions *** --- Testing wordwrap() function with Zero arguments -- - -Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing wordwrap() function with more than expected no. of arguments -- - -Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing wordwrap() function with negative/zero value for width argument -- -- width = 0 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" |