From a19e28ece92092931e39cee08723044010ba2dcf Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Thu, 20 Mar 2008 00:50:47 +0000 Subject: [PATCH] Fix bug #44487 (call_user_method_array issues a warning when throwing an exception). --- ext/standard/basic_functions.c | 12 ++++++---- .../tests/general_functions/bug44487.phpt | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 ext/standard/tests/general_functions/bug44487.phpt diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index df1394f143..c329e724be 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5140,8 +5140,10 @@ PHP_FUNCTION(call_user_method) convert_to_text(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 %R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback)); } @@ -5183,8 +5185,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 %R()", Z_TYPE_P(callback), Z_UNIVAL_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 -- 2.50.1