summaryrefslogtreecommitdiff
path: root/ext/pcre/tests
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-03-21 16:54:45 +0800
committerXinchen Hui <laruence@php.net>2015-03-21 16:54:45 +0800
commit4180226117f90dd24f15fcdd793deef26c3cdf3c (patch)
tree016d178bfc09a3696899ca17b8456251a39f25f2 /ext/pcre/tests
parentcda8e60638d3d72579f7b28180af481366d380c2 (diff)
downloadphp-git-4180226117f90dd24f15fcdd793deef26c3cdf3c.tar.gz
More error conditions
Diffstat (limited to 'ext/pcre/tests')
-rw-r--r--ext/pcre/tests/preg_replace_callback_array.phpt17
-rw-r--r--ext/pcre/tests/preg_replace_callback_array2.phpt8
2 files changed, 21 insertions, 4 deletions
diff --git a/ext/pcre/tests/preg_replace_callback_array.phpt b/ext/pcre/tests/preg_replace_callback_array.phpt
index 529f704db6..14a4656eb1 100644
--- a/ext/pcre/tests/preg_replace_callback_array.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array.phpt
@@ -4,12 +4,19 @@ preg_replace_callback_array() basic functions
<?php
function f() {
- throw new Exception();
+ throw new Exception('f');
+}
+
+function a() {
+ return __FUNCTION__;
}
try {
-var_dump(preg_replace_callback_array(array('/\w/' => 'f'), 'z'));
-} catch(Exception $e) {}
+ var_dump($c = preg_replace_callback_array(array('/\w*/' => 'f', '/\w/' => 'a'), 'z'));
+} catch(Exception $e) {
+ var_dump($e->getMessage());
+}
+var_dump($c);
function g($x) {
return "'$x[0]'";
@@ -22,6 +29,10 @@ var_dump(preg_replace_callback_array(array('~\A.~' => 'g'), array(array('xyz')))
var_dump(preg_replace_callback_array(array('~\A.~' => create_function('$m', 'return strtolower($m[0]);')), 'ABC'));
?>
--EXPECTF--
+string(1) "f"
+
+Notice: Undefined variable: c in %spreg_replace_callback_array.php on line %d
+NULL
array(3) {
[0]=>
string(12) "'a' 'b3' bcd"
diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt
index c3d3acf0a8..fca71673c9 100644
--- a/ext/pcre/tests/preg_replace_callback_array2.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array2.phpt
@@ -18,7 +18,10 @@ var_dump($b);
$b = "";
var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b));
var_dump($b);
+function f() {
+}
+var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z'));
echo "Done\n";
?>
--EXPECTF--
@@ -44,8 +47,11 @@ Warning: preg_replace_callback() expects parameter 4 to be integer, array given
NULL
string(0) ""
-Warning: preg_replace_callback_array(): 's' is not a valid callback in %s on line %d
+Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d
array(0) {
}
string(0) ""
+
+Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d
+NULL
Done