diff options
Diffstat (limited to 'ext/pcre/tests')
| -rw-r--r-- | ext/pcre/tests/002.phpt | 18 | ||||
| -rw-r--r-- | ext/pcre/tests/grep2.phpt | 10 | ||||
| -rw-r--r-- | ext/pcre/tests/preg_grep_error1.phpt | 20 | ||||
| -rw-r--r-- | ext/pcre/tests/preg_match_all_error1.phpt | 20 | ||||
| -rw-r--r-- | ext/pcre/tests/preg_match_all_error2.phpt | 17 | ||||
| -rw-r--r-- | ext/pcre/tests/preg_match_error1.phpt | 20 | ||||
| -rw-r--r-- | ext/pcre/tests/preg_match_error2.phpt | 20 | ||||
| -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_split_error1.phpt | 20 | ||||
| -rw-r--r-- | ext/pcre/tests/split.phpt | 6 | ||||
| -rw-r--r-- | ext/pcre/tests/split2.phpt | 4 |
12 files changed, 71 insertions, 139 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/grep2.phpt b/ext/pcre/tests/grep2.phpt index a739cb60ac..5aee98b9e4 100644 --- a/ext/pcre/tests/grep2.phpt +++ b/ext/pcre/tests/grep2.phpt @@ -5,8 +5,6 @@ preg_grep() 2nd test --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'); @@ -21,13 +19,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/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index fcc36e7d91..79fcb98897 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -20,10 +20,18 @@ $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)); + 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 +58,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 +67,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..bd0f28c8c4 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -20,11 +20,19 @@ $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)); + 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 +63,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 +81,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..8c52b73076 100644 --- a/ext/pcre/tests/preg_match_all_error2.phpt +++ b/ext/pcre/tests/preg_match_all_error2.phpt @@ -12,13 +12,14 @@ error_reporting(E_ALL&~E_NOTICE); */ 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)); + try { + var_dump(preg_match_all($regex, $value, $matches)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($matches); } echo "Done"; @@ -26,14 +27,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..23d6829c48 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -20,10 +20,18 @@ $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)); + 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 +57,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..9530983e81 100644 --- a/ext/pcre/tests/preg_match_error2.phpt +++ b/ext/pcre/tests/preg_match_error2.phpt @@ -15,10 +15,18 @@ $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)); + 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 +36,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_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_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt index 79942a9480..1c1e3ec646 100644 --- a/ext/pcre/tests/preg_split_error1.phpt +++ b/ext/pcre/tests/preg_split_error1.phpt @@ -20,10 +20,18 @@ $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)); + 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 +57,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 +68,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 b0411e6df2..f4fd60022e 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) array(1) { [0]=> |
