From: Marcus Boerger Date: Sat, 27 Dec 2003 21:10:34 +0000 (+0000) Subject: Bugfix #25038 (call_user_func issues warning if function throws exception) X-Git-Tag: php_ibase_before_split~473 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a84f8156ff6a92c04519c770743887c4226acc5e;p=php Bugfix #25038 (call_user_func issues warning if function throws exception) --- diff --git a/NEWS b/NEWS index ee0facd2ec..8863d52844 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ PHP NEWS (Ilia) - Fixed bug #26680 (Added version check in mysqli_report_index) (Georg) - Fixed bug #26675 (Segfault on ArrayAccess use). (Marcus) +- Fixed bug #25038 (call_user_func issues warning if function throws + exception). (Marcus) 21 Dec 2003, PHP 5 Beta 3 - Bundled new tidy extension (John, Wez) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 3850c48803..17ae114502 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1830,8 +1830,10 @@ PHP_FUNCTION(call_user_func) RETURN_NULL(); } - if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS) { + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); + } } else { if (argc > 1) { SEPARATE_ZVAL(params[1]); diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt new file mode 100755 index 0000000000..52fe032056 --- /dev/null +++ b/ext/standard/tests/general_functions/bug25038.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #25038 (call_user_func issues warning if function throws exception) +--FILE-- +getMessage()."\n"; +} +try +{ + call_user_func('bar','second try'); +} +catch (Exception $e) +{ + print $e->getMessage()."\n"; +} + +?> +===DONE=== +--EXPECT-- +This is an exception from bar(first try). +This is an exception from bar(second try). +===DONE===