From: David Soria Parra Date: Thu, 20 Mar 2008 00:52:46 +0000 (+0000) Subject: MFH: Fix bug #44487 (call_user_method_array issues a warning when throwing an exception). X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~516 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d66530ae9514ac0368c5375816ee2205f9a5938;p=php MFH: Fix bug #44487 (call_user_method_array issues a warning when throwing an exception). --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d4737654a4..e2acdec385 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5172,8 +5172,10 @@ PHP_FUNCTION(call_user_method) convert_to_string(callback); - if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, 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()", Z_STRVAL_P(callback)); } @@ -5214,8 +5216,10 @@ PHP_FUNCTION(call_user_method_array) element++; } - if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 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()", Z_STRVAL_P(callback)); } diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt new file mode 100644 index 0000000000..10c52c6b3f --- /dev/null +++ b/ext/standard/tests/general_functions/bug44487.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #44487 (call_user_method_array issues a warning when throwing an exception) +--INI-- +error_reporting = E_ALL & ~E_DEPRECATED +--FILE-- + +--EXPECT-- +test