diff options
-rw-r--r-- | ext/pcre/php_pcre.c | 8 | ||||
-rw-r--r-- | ext/pcre/tests/002.phpt | 9 | ||||
-rw-r--r-- | ext/pcre/tests/preg_replace_callback_array2.phpt | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index acaeb19dc6..801d19fc4f 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1193,8 +1193,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, } if ((global && (subpats_order < PREG_PATTERN_ORDER || subpats_order > PREG_SET_ORDER)) || (!global && subpats_order != 0)) { - php_error_docref(NULL, E_WARNING, "Invalid flags specified"); - return; + zend_argument_value_error(4, "must be a PREG_* constant"); + RETURN_THROWS(); } } else { offset_capture = 0; @@ -2410,9 +2410,7 @@ PHP_FUNCTION(preg_replace_callback_array) } if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) { - zend_string *callback_name = zend_get_callable_name(replace); - zend_type_error("'%s' is not a valid callback", ZSTR_VAL(callback_name)); - zend_string_release_ex(callback_name, 0); + zend_argument_type_error(1, "must contain only valid callbacks"); RETURN_THROWS(); } diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt index 073a7a8d56..641cffb05e 100644 --- a/ext/pcre/tests/002.phpt +++ b/ext/pcre/tests/002.phpt @@ -3,7 +3,11 @@ preg_* with bogus vals --FILE-- <?php -var_dump(preg_match_all('//', '', $dummy, 0xdead)); +try { + preg_match_all('//', '', $dummy, 0xdead); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} var_dump(preg_quote('')); @@ -13,8 +17,7 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc')); ?> --EXPECTF-- -Warning: preg_match_all(): Invalid flags specified in %s002.php on line %d -NULL +preg_match_all(): Argument #4 ($flags) must be a PREG_* constant string(0) "" string(12) "a${1b${1c${1" diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt index 679a4b0c54..aca11dc19c 100644 --- a/ext/pcre/tests/preg_replace_callback_array2.phpt +++ b/ext/pcre/tests/preg_replace_callback_array2.phpt @@ -30,7 +30,7 @@ try { echo "Done\n"; ?> --EXPECTF-- -'s' is not a valid callback +preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks string(0) "" Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d |