mirror of
https://github.com/php/php-src.git
synced 2026-04-29 11:13:36 +02:00
Fixed preg_replace_callback() with callback defined by array
This commit is contained in:
+3
-1
@@ -1422,7 +1422,9 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callabl
|
||||
}
|
||||
|
||||
if (is_callable_replace) {
|
||||
convert_to_text(replace);
|
||||
if (Z_TYPE_P(replace) != IS_ARRAY) {
|
||||
convert_to_text(replace);
|
||||
}
|
||||
if (!zend_is_callable(replace, 0, &callback_name)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
|
||||
zval_dtor(&callback_name);
|
||||
|
||||
@@ -27,3 +27,16 @@ array(4) {
|
||||
string(1) "e"
|
||||
}
|
||||
string(4) "yes!"
|
||||
--UEXPECT--
|
||||
bool(false)
|
||||
array(4) {
|
||||
[0]=>
|
||||
unicode(5) "abcde"
|
||||
[1]=>
|
||||
unicode(2) "ab"
|
||||
[2]=>
|
||||
unicode(2) "cd"
|
||||
[3]=>
|
||||
unicode(1) "e"
|
||||
}
|
||||
unicode(4) "yes!"
|
||||
|
||||
Reference in New Issue
Block a user