diff options
Diffstat (limited to 'ext/pcre/tests')
-rw-r--r-- | ext/pcre/tests/002.phpt | 18 | ||||
-rw-r--r-- | ext/pcre/tests/bug21732.phpt | 10 | ||||
-rw-r--r-- | ext/pcre/tests/bug44925.phpt | 4 | ||||
-rw-r--r-- | ext/pcre/tests/grep2.phpt | 10 | ||||
-rw-r--r-- | ext/pcre/tests/pcre_extra.phpt | 5 | ||||
-rw-r--r-- | ext/pcre/tests/preg_grep_error1.phpt | 23 | ||||
-rw-r--r-- | ext/pcre/tests/preg_match_all_error1.phpt | 23 | ||||
-rw-r--r-- | ext/pcre/tests/preg_match_all_error2.phpt | 20 | ||||
-rw-r--r-- | ext/pcre/tests/preg_match_error1.phpt | 23 | ||||
-rw-r--r-- | ext/pcre/tests/preg_match_error2.phpt | 23 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace2.phpt | 6 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_callback2.phpt | 2 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_callback3.phpt | 22 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_callback_array2.phpt | 33 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_callback_error1.phpt | 9 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_error1.phpt | 3 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_error2.phpt | 13 | ||||
-rw-r--r-- | ext/pcre/tests/preg_split_error1.phpt | 23 | ||||
-rw-r--r-- | ext/pcre/tests/split.phpt | 6 | ||||
-rw-r--r-- | ext/pcre/tests/split2.phpt | 4 |
20 files changed, 102 insertions, 178 deletions
diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt index d4780447bc..073a7a8d56 100644 --- a/ext/pcre/tests/002.phpt +++ b/ext/pcre/tests/002.phpt @@ -3,11 +3,8 @@ preg_* with bogus vals --FILE-- <?php -var_dump(preg_match()); -var_dump(preg_match_all()); var_dump(preg_match_all('//', '', $dummy, 0xdead)); -var_dump(preg_quote()); var_dump(preg_quote('')); var_dump(preg_replace('/(.)/', '${1}${1', 'abc')); @@ -16,22 +13,13 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc')); ?> --EXPECTF-- -Warning: preg_match() expects at least 2 parameters, 0 given in %s002.php on line 3 -bool(false) - -Warning: preg_match_all() expects at least 2 parameters, 0 given in %s002.php on line 4 -bool(false) - -Warning: preg_match_all(): Invalid flags specified in %s002.php on line 5 -NULL - -Warning: preg_quote() expects at least 1 parameter, 0 given in %s002.php on line 7 +Warning: preg_match_all(): Invalid flags specified in %s002.php on line %d NULL string(0) "" string(12) "a${1b${1c${1" -Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11 +Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d NULL -Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line 12 +Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d NULL diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt index 3dfc41e19f..629e015a06 100644 --- a/ext/pcre/tests/bug21732.phpt +++ b/ext/pcre/tests/bug21732.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #21732 (preg_replace() segfaults with invalid parameters) ---INI-- -error_reporting=0 --FILE-- <?php class foo { @@ -11,11 +9,15 @@ class foo { } } -var_dump(preg_replace('', array(), '')); +try { + var_dump(preg_replace('', array(), '')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde')); ?> --EXPECT-- -bool(false) +Parameter mismatch, pattern is a string while replacement is an array array(4) { [0]=> string(5) "abcde" diff --git a/ext/pcre/tests/bug44925.phpt b/ext/pcre/tests/bug44925.phpt index f6e0db4253..c495331b4b 100644 --- a/ext/pcre/tests/bug44925.phpt +++ b/ext/pcre/tests/bug44925.phpt @@ -45,11 +45,11 @@ array(9) { &string(1) "b" } -Notice: Array to string conversion in %sbug44925.php on line 9 +Warning: Array to string conversion in %s on line %d array(0) { } -Notice: Array to string conversion in %sbug44925.php on line 11 +Warning: Array to string conversion in %s on line %d array(7) { [0]=> string(1) "1" diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt index 4c6f9b155f..9721dfbd9e 100644 --- a/ext/pcre/tests/grep2.phpt +++ b/ext/pcre/tests/grep2.phpt @@ -7,8 +7,6 @@ pcre.jit=1 --FILE-- <?php -var_dump(preg_grep(1,array(),3,4)); -var_dump(preg_grep(1, 2)); var_dump(preg_grep('/+/', array())); $array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20'); @@ -23,13 +21,7 @@ var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR); ?> --EXPECTF-- -Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3 -NULL - -Warning: preg_grep() expects parameter 2 to be array, int given in %sgrep2.php on line 4 -NULL - -Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line 5 +Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d bool(false) array(3) { [5]=> diff --git a/ext/pcre/tests/pcre_extra.phpt b/ext/pcre/tests/pcre_extra.phpt index 4c5930f975..730c729939 100644 --- a/ext/pcre/tests/pcre_extra.phpt +++ b/ext/pcre/tests/pcre_extra.phpt @@ -1,5 +1,5 @@ --TEST-- -X (PCRE_EXTRA) modifier +X (PCRE_EXTRA) modifier is ignored (no error, no change) --FILE-- <?php @@ -8,7 +8,8 @@ var_dump(preg_match('/\y/X', '\y')); ?> --EXPECTF-- -int(1) +Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 3 +bool(false) Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 4 bool(false) diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index fcc36e7d91..1bf23bb640 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -6,7 +6,6 @@ Test preg_grep() function : error conditions - bad regular expressions * proto array preg_grep(string regex, array input [, int flags]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_grep reacts to being passed bad regexes */ @@ -19,11 +18,19 @@ $values = array('abcdef', //Regex without delimiter ); $array = array(123, 'abc', 'test'); foreach($values as $value) { - print "\nArg value is $value\n"; - var_dump(preg_grep($value, $array)); + @print "\nArg value is $value\n"; + try { + var_dump(preg_grep($value, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $value = new stdclass(); //Object -var_dump(preg_grep($value, $array)); +try { + var_dump(preg_grep($value, $array)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> --EXPECTF-- @@ -50,9 +57,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d bool(false) Arg value is Array - -Warning: preg_grep() expects parameter 1 to be string, array given in %spreg_grep_error1.php on line %d -NULL +preg_grep() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ array(2) { @@ -61,7 +66,5 @@ array(2) { [2]=> string(4) "test" } - -Warning: preg_grep() expects parameter 1 to be string, object given in %spreg_grep_error1.php on line %d -NULL +preg_grep() expects parameter 1 to be string, object given Done diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt index 95ab905d7d..6a5a0055a9 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -6,7 +6,6 @@ Test preg_match_all() function : error conditions - bad regular expressions * proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_match_all reacts to being passed the wrong type of regex argument */ @@ -19,12 +18,20 @@ $regex_array = array('abcdef', //Regex without delimiter ); $subject = 'test'; foreach($regex_array as $regex_value) { - print "\nArg value is $regex_value\n"; - var_dump(preg_match_all($regex_value, $subject, $matches1)); + @print "\nArg value is $regex_value\n"; + try { + var_dump(preg_match_all($regex_value, $subject, $matches1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($matches1); } $regex_value = new stdclass(); //Object -var_dump(preg_match_all($regex_value, $subject, $matches)); +try { + var_dump(preg_match_all($regex_value, $subject, $matches)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($matches); ?> --EXPECTF-- @@ -55,9 +62,7 @@ bool(false) NULL Arg value is Array - -Warning: preg_match_all() expects parameter 1 to be string, array given in %spreg_match_all_error1.php on line %d -bool(false) +preg_match_all() expects parameter 1 to be string, array given NULL Arg value is /[a-zA-Z]/ @@ -75,7 +80,5 @@ array(1) { string(1) "t" } } - -Warning: preg_match_all() expects parameter 1 to be string, object given in %spreg_match_all_error1.php on line %d -bool(false) +preg_match_all() expects parameter 1 to be string, object given NULL diff --git a/ext/pcre/tests/preg_match_all_error2.phpt b/ext/pcre/tests/preg_match_all_error2.phpt index 1c55cce64e..29762739c4 100644 --- a/ext/pcre/tests/preg_match_all_error2.phpt +++ b/ext/pcre/tests/preg_match_all_error2.phpt @@ -6,19 +6,19 @@ Test preg_match_all() function : error conditions - wrong arg types * proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_match_all reacts to being passed the wrong type of input argument */ echo "*** Testing preg_match_all() : error conditions ***\n"; $regex = '/[a-zA-Z]/'; -$value = new stdclass(); //Object -var_dump(preg_match_all($regex, $value, $matches)); -var_dump($matches); $input = array(array('this is', 'a subarray'), 'test',); foreach($input as $value) { - print "\nArg value is: $value\n"; - var_dump(preg_match_all($regex, $value, $matches)); + @print "\nArg value is: $value\n"; + try { + var_dump(preg_match_all($regex, $value, $matches)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($matches); } echo "Done"; @@ -26,14 +26,8 @@ echo "Done"; --EXPECTF-- *** Testing preg_match_all() : error conditions *** -Warning: preg_match_all() expects parameter 2 to be string, object given in %spreg_match_all_error2.php on line %d -bool(false) -NULL - Arg value is: Array - -Warning: preg_match_all() expects parameter 2 to be string, array given in %spreg_match_all_error2.php on line %d -bool(false) +preg_match_all() expects parameter 2 to be string, array given NULL Arg value is: test diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt index 42bb5abd27..2f1b39d67f 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -6,7 +6,6 @@ Test preg_match() function : error conditions - bad regular expressions * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_match reacts to being passed the wrong type of regex argument */ @@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter ); $subject = 'this is a test'; foreach($regex_array as $regex_value) { - print "\nArg value is $regex_value\n"; - var_dump(preg_match($regex_value, $subject)); + @print "\nArg value is $regex_value\n"; + try { + var_dump(preg_match($regex_value, $subject)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $regex_value = new stdclass(); //Object -var_dump(preg_match($regex_value, $subject)); +try { + var_dump(preg_match($regex_value, $subject)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- *** Testing preg_match() : error conditions *** @@ -49,12 +56,8 @@ Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line % bool(false) Arg value is Array - -Warning: preg_match() expects parameter 1 to be string, array given in %spreg_match_error1.php on line %d -bool(false) +preg_match() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ int(1) - -Warning: preg_match() expects parameter 1 to be string, object given in %spreg_match_error1.php on line %d -bool(false) +preg_match() expects parameter 1 to be string, object given diff --git a/ext/pcre/tests/preg_match_error2.phpt b/ext/pcre/tests/preg_match_error2.phpt index cb0917a228..18a42c6445 100644 --- a/ext/pcre/tests/preg_match_error2.phpt +++ b/ext/pcre/tests/preg_match_error2.phpt @@ -6,7 +6,6 @@ Test preg_match() function : error conditions - wrong arg types * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_match reacts to being passed the wrong type of subject argument */ @@ -14,11 +13,19 @@ echo "*** Testing preg_match() : error conditions ***\n"; $regex = '/[a-zA-Z]/'; $input = array('this is a string', array('this is', 'a subarray'),); foreach($input as $value) { - print "\nArg value is: $value\n"; - var_dump(preg_match($regex, $value)); + @print "\nArg value is: $value\n"; + try { + var_dump(preg_match($regex, $value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $value = new stdclass(); //Object -var_dump(preg_match($regex, $value)); +try { + var_dump(preg_match($regex, $value)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- @@ -28,10 +35,6 @@ Arg value is: this is a string int(1) Arg value is: Array - -Warning: preg_match() expects parameter 2 to be string, array given in %spreg_match_error2.php on line %d -bool(false) - -Warning: preg_match() expects parameter 2 to be string, object given in %spreg_match_error2.php on line %d -bool(false) +preg_match() expects parameter 2 to be string, array given +preg_match() expects parameter 2 to be string, object given Done diff --git a/ext/pcre/tests/preg_replace2.phpt b/ext/pcre/tests/preg_replace2.phpt index 4a191f3331..13696827fb 100644 --- a/ext/pcre/tests/preg_replace2.phpt +++ b/ext/pcre/tests/preg_replace2.phpt @@ -9,8 +9,6 @@ if (@preg_match('/./u', '') === false) { --FILE-- <?php -var_dump(preg_replace('', array(), '')); - var_dump(preg_replace(array('/\da(.)/ui', '@..@'), '$1', '12Abc')); var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av2Ab'))); @@ -21,9 +19,7 @@ var_dump(preg_replace(array('/\s+/', '~[b-d]~'), array('$'), array('x y', 'bd bc echo "==done==\n"; ?> ---EXPECTF-- -Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace2.php on line 3 -bool(false) +--EXPECT-- string(1) "c" array(3) { [0]=> diff --git a/ext/pcre/tests/preg_replace_callback2.phpt b/ext/pcre/tests/preg_replace_callback2.phpt index 1fe78d59ee..6dab1a0cf2 100644 --- a/ext/pcre/tests/preg_replace_callback2.phpt +++ b/ext/pcre/tests/preg_replace_callback2.phpt @@ -31,7 +31,7 @@ array(3) { string(9) "'aa' 'bb'" } -Notice: Array to string conversion in %spreg_replace_callback2.php on line 17 +Warning: Array to string conversion in %s on line %d array(1) { [0]=> string(7) "'A'rray" diff --git a/ext/pcre/tests/preg_replace_callback3.phpt b/ext/pcre/tests/preg_replace_callback3.phpt index f5c87176f9..842dfacb39 100644 --- a/ext/pcre/tests/preg_replace_callback3.phpt +++ b/ext/pcre/tests/preg_replace_callback3.phpt @@ -3,30 +3,14 @@ preg_replace_callback() 3 --FILE-- <?php -var_dump(preg_replace_callback()); -var_dump(preg_replace_callback(1)); -var_dump(preg_replace_callback(1,2)); var_dump(preg_replace_callback(1,2,3)); var_dump(preg_replace_callback(1,2,3,4)); $a = 5; var_dump(preg_replace_callback(1,2,3,4,$a)); -$a = ""; -var_dump(preg_replace_callback("","","","",$a)); -$a = array(); -var_dump(preg_replace_callback($a,$a,$a,$a,$a)); echo "Done\n"; ?> --EXPECTF-- -Warning: preg_replace_callback() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: preg_replace_callback() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: preg_replace_callback() expects at least 3 parameters, 2 given in %s on line %d -NULL - Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d string(1) "3" @@ -35,10 +19,4 @@ string(1) "3" Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d string(1) "3" - -Warning: preg_replace_callback() expects parameter 4 to be int, string given in %s on line %d -NULL - -Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d -NULL Done diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt index f2f20ef645..03d7a60eee 100644 --- a/ext/pcre/tests/preg_replace_callback_array2.phpt +++ b/ext/pcre/tests/preg_replace_callback_array2.phpt @@ -3,19 +3,8 @@ preg_replace_callback_array() errors --FILE-- <?php -var_dump(preg_replace_callback_array()); -var_dump(preg_replace_callback_array(1)); -var_dump(preg_replace_callback_array(1,2)); -var_dump(preg_replace_callback_array(1,2,3)); -$a = 5; -var_dump(preg_replace_callback_array(1,2,3,$a)); -$a = ""; -var_dump(preg_replace_callback_array(array("" => ""),"","",$a)); $a = array(); $b = ""; -var_dump(preg_replace_callback($a, $a, $a, $a, $b)); -var_dump($b); -$b = ""; var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b)); var_dump($b); function f() { @@ -34,28 +23,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: preg_replace_callback_array() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: preg_replace_callback_array() expects parameter 3 to be int, string given in %s on line %d -NULL - -Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d -NULL -string(0) "" - Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d array(0) { } diff --git a/ext/pcre/tests/preg_replace_callback_error1.phpt b/ext/pcre/tests/preg_replace_callback_error1.phpt index 313064eab8..cf069692e8 100644 --- a/ext/pcre/tests/preg_replace_callback_error1.phpt +++ b/ext/pcre/tests/preg_replace_callback_error1.phpt @@ -6,7 +6,6 @@ Test preg_replace_callback() function : error * proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_replace_callback reacts to being passed the wrong type of regex argument */ @@ -15,7 +14,7 @@ $regex_array = array('abcdef', //Regex without delimiters '/[a-zA-Z]', //Regex without closing delimiter '[a-zA-Z]/', //Regex without opening delimiter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes -'[A-Z]', '[0-9]'), '/[a-zA-Z]/'); //Regex string +'[A-Z]', '[0-9]'), '/[0-9]/'); //Regex string $replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'); function integer_word($matches) { global $replacement; @@ -23,7 +22,7 @@ function integer_word($matches) { } $subject = 'number 1.'; foreach($regex_array as $regex_value) { - print "\nArg value is $regex_value\n"; + @print "\nArg value is $regex_value\n"; var_dump(preg_replace_callback($regex_value, 'integer_word', $subject)); } ?> @@ -54,6 +53,6 @@ NULL Arg value is Array string(9) "number 1." -Arg value is /[a-zA-Z]/ -string(3) " 1." +Arg value is /[0-9]/ +string(11) "number one." ===Done=== diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt index 780556956a..669a5c6c4e 100644 --- a/ext/pcre/tests/preg_replace_error1.phpt +++ b/ext/pcre/tests/preg_replace_error1.phpt @@ -6,7 +6,6 @@ Test preg_replace() function : error - bad regular expressions * proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_replace reacts to being passed the wrong type of regex argument */ @@ -20,7 +19,7 @@ $regex_array = array('abcdef', //Regex without delimiter $replace = 1; $subject = 'a'; foreach($regex_array as $regex_value) { - print "\nArg value is $regex_value\n"; + @print "\nArg value is $regex_value\n"; var_dump(preg_replace($regex_value, $replace, $subject)); } $regex_value = new stdclass(); //Object diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt index a334b2fefd..eeff2fae54 100644 --- a/ext/pcre/tests/preg_replace_error2.phpt +++ b/ext/pcre/tests/preg_replace_error2.phpt @@ -6,7 +6,6 @@ Test preg_replace() function : error conditions - wrong arg types * proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_replace reacts to being passed the wrong type of replacement argument */ @@ -15,8 +14,12 @@ $regex = '/[a-zA-Z]/'; $replace = array('this is a string', array('this is', 'a subarray'),); $subject = 'test'; foreach($replace as $value) { - print "\nArg value is: $value\n"; - var_dump(preg_replace($regex, $value, $subject)); + @print "\nArg value is: $value\n"; + try { + var_dump(preg_replace($regex, $value, $subject)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $value = new stdclass(); //Object try { @@ -33,8 +36,6 @@ Arg value is: this is a string string(64) "this is a stringthis is a stringthis is a stringthis is a string" Arg value is: Array - -Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace_error2.php on line %d -bool(false) +Parameter mismatch, pattern is a string while replacement is an array Object of class stdClass could not be converted to string Done diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt index 79942a9480..b69caf1aed 100644 --- a/ext/pcre/tests/preg_split_error1.phpt +++ b/ext/pcre/tests/preg_split_error1.phpt @@ -6,7 +6,6 @@ Test preg_split() function : error conditions - bad regular expressions * proto array preg_split(string pattern, string subject [, int limit [, int flags]]) * Function is implemented in ext/pcre/php_pcre.c */ -error_reporting(E_ALL&~E_NOTICE); /* * Testing how preg_split reacts to being passed the wrong type of regex argument */ @@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter ); $subject = '1 2 a 3 4 b 5 6'; foreach($regex_array as $regex_value) { - print "\nArg value is $regex_value\n"; - var_dump(preg_split($regex_value, $subject)); + @print "\nArg value is $regex_value\n"; + try { + var_dump(preg_split($regex_value, $subject)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } $regex_value = new stdclass(); //Object -var_dump(preg_split($regex_value, $subject)); +try { + var_dump(preg_split($regex_value, $subject)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- *** Testing preg_split() : error conditions *** @@ -49,9 +56,7 @@ Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line % bool(false) Arg value is Array - -Warning: preg_split() expects parameter 1 to be string, array given in %spreg_split_error1.php on line %d -bool(false) +preg_split() expects parameter 1 to be string, array given Arg value is /[a-zA-Z]/ array(3) { @@ -62,6 +67,4 @@ array(3) { [2]=> string(4) " 5 6" } - -Warning: preg_split() expects parameter 1 to be string, object given in %spreg_split_error1.php on line %d -bool(false) +preg_split() expects parameter 1 to be string, object given diff --git a/ext/pcre/tests/split.phpt b/ext/pcre/tests/split.phpt index c87d1b03a9..df4b9af92f 100644 --- a/ext/pcre/tests/split.phpt +++ b/ext/pcre/tests/split.phpt @@ -3,7 +3,6 @@ preg_split() --FILE-- <?php -var_dump(preg_split()); var_dump(preg_split('/*/', 'x')); var_dump(preg_split('/[\s, ]+/', 'x yy,zzz')); @@ -17,10 +16,7 @@ var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY)); ?> --EXPECTF-- -Warning: preg_split() expects at least 2 parameters, 0 given in %ssplit.php on line 3 -bool(false) - -Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line 4 +Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line %d bool(false) array(3) { [0]=> diff --git a/ext/pcre/tests/split2.phpt b/ext/pcre/tests/split2.phpt index 5c77c6d1bc..5fafee3b87 100644 --- a/ext/pcre/tests/split2.phpt +++ b/ext/pcre/tests/split2.phpt @@ -13,7 +13,6 @@ var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPL var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE)); -var_dump(preg_last_error(1)); ini_set('pcre.recursion_limit', 1); var_dump(preg_last_error() == PREG_NO_ERROR); var_dump(preg_split('/(\d*)/', 'ab2c3u')); @@ -306,9 +305,6 @@ array(6) { int(5) } } - -Warning: preg_last_error() expects exactly 0 parameters, 1 given in %s on line %d -NULL bool(true) bool(false) bool(true) |