summaryrefslogtreecommitdiff
path: root/ext/pcre/php_pcre.c
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2017-06-26 17:22:01 +0200
committerRemi Collet <remi@php.net>2017-06-26 17:22:01 +0200
commit85c32322acfc07628140bf631e7c52b12e6050b4 (patch)
treeae79035283e68957177407123d7d342278e021d9 /ext/pcre/php_pcre.c
parent4ed8ff509001b35e0cb971a1d6a294345c5d7673 (diff)
parentcaaeb4849aa56cbbdc66ea015c11a58bd47a43ff (diff)
downloadphp-git-85c32322acfc07628140bf631e7c52b12e6050b4.tar.gz
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: (24 commits) Removed EG(valid_symbol_table). Used EG(active) instead. Release temporary string reference Remove superfluous semicolons Fix tests on Windows Produce a better exception message when IntlDateFormatter constructor fails. Fix format arguments Remove unused variable op2. It is redeclared later. Fix typo Implement object type annotation Fixed bug #73173 Expose inflate_get_status() and inflate_get_read_len() functions Add more constants, improve comments, and add tests Fixed bug #73900 Add OPENSSL_DONT_ZERO_PAD_KEY constant to prevent key padding Drop soap_hash_str_find_deref() Only compute callback name in error cases Extract zend_get_callable_name() API Move va_copy compatibility code into zend_portability.h Remove unnecessary string copy Fix FE_FETCH_* exception check ...
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r--ext/pcre/php_pcre.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 615c83ae65..131f096f47 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -2037,7 +2037,6 @@ static PHP_FUNCTION(preg_replace_callback)
{
zval *regex, *replace, *subject, *zcount = NULL;
zend_long limit = -1;
- zend_string *callback_name;
int replace_count;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -2052,13 +2051,13 @@ static PHP_FUNCTION(preg_replace_callback)
Z_PARAM_ZVAL_DEREF(zcount)
ZEND_PARSE_PARAMETERS_END();
- if (!zend_is_callable_ex(replace, NULL, 0, &callback_name, &fcc, NULL)) {
+ if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(replace);
php_error_docref(NULL, E_WARNING, "Requires argument 2, '%s', to be a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
ZVAL_STR(return_value, zval_get_string(subject));
return;
}
- zend_string_release(callback_name);
fci.size = sizeof(fci);
fci.object = NULL;
@@ -2079,7 +2078,6 @@ static PHP_FUNCTION(preg_replace_callback_array)
zval regex, zv, *replace, *subject, *pattern, *zcount = NULL;
zend_long limit = -1;
zend_string *str_idx;
- zend_string *callback_name;
int replace_count = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -2105,7 +2103,8 @@ static PHP_FUNCTION(preg_replace_callback_array)
RETURN_NULL();
}
- if (!zend_is_callable_ex(replace, NULL, 0, &callback_name, &fcc, NULL)) {
+ if (!zend_is_callable_ex(replace, NULL, 0, NULL, &fcc, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(replace);
php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", ZSTR_VAL(callback_name));
zend_string_release(callback_name);
zval_ptr_dtor(&regex);
@@ -2113,7 +2112,6 @@ static PHP_FUNCTION(preg_replace_callback_array)
ZVAL_COPY(return_value, subject);
return;
}
- zend_string_release(callback_name);
ZVAL_COPY_VALUE(&fci.function_name, replace);