From: Dmitry Stogov Date: Tue, 18 Jan 2005 10:33:50 +0000 (+0000) Subject: Fixed bug #31190 (iexceptions in call_user_func_array()) X-Git-Tag: php-5.0.4RC1~324 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03096147f6356716fbff7d4c171ecdeb2a6f6658;p=php Fixed bug #31190 (iexceptions in call_user_func_array()) --- diff --git a/NEWS b/NEWS index 58540a4038..77ad05311a 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ PHP NEWS - Fixed bug #31396 (compile fails with gd 2.0.33 without freetype). (Jani) - Fixed bug #31371 (highlight_file() trims new line after heredoc). (Ilia) - Fixed bug #31361 (simplexml/domxml segfault when adding node twice). (Rob) +- Fixed bug #31190 (call_user_func_array(), exceptions, and the patch). + (phpbugs at domain51 dot net, Dmitry) - Fixed bug #31142 (imap_mail_compose() fails to generate correct output). (Ilia) - Fixed bug #31139 (XML Parser Functions seem to drop & when parsing). (Rob) - Fixed bug #31111 (Compile failure of zend_strtod.c). (Derick) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 68cbbe96a1..9c67d7d95c 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1993,8 +1993,10 @@ PHP_FUNCTION(call_user_func_array) current++; } - if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL TSRMLS_CC) == SUCCESS) { + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", name); } diff --git a/ext/standard/tests/general_functions/bug31190.phpt b/ext/standard/tests/general_functions/bug31190.phpt new file mode 100644 index 0000000000..8fdf8eea75 --- /dev/null +++ b/ext/standard/tests/general_functions/bug31190.phpt @@ -0,0 +1,26 @@ +--TEST-- +bug #31190 (exception in call_user_func_array()) +--FILE-- +getMessage(); +} + +try { + call_user_func_array($array, array(1, 2)); +} catch (Exception $e) { + echo $e->getMessage(); +} +?> +--EXPECT-- +Hello World! +Hello World! +