1
0
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:
Dmitry Stogov
2007-07-10 09:11:35 +00:00
parent a84dbc7cb6
commit 4a49ce8b8f
2 changed files with 16 additions and 1 deletions
+3 -1
View File
@@ -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);
+13
View File
@@ -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!"