dmitry Tue Jan 18 05:38:04 2005 EDT Modified files: /php-src/ext/standard basic_functions.c /php-src/ext/standard/tests/general_functions bug31190.phpt Log: Fixed bug #31190 (exceptions in call_user_func_array()) http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.703&r2=1.704&ty=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.703 php-src/ext/standard/basic_functions.c:1.704 --- php-src/ext/standard/basic_functions.c:1.703 Sun Jan 9 11:30:08 2005 +++ php-src/ext/standard/basic_functions.c Tue Jan 18 05:38:03 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.703 2005/01/09 16:30:08 sniper Exp $ */ +/* $Id: basic_functions.c,v 1.704 2005/01/18 10:38:03 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -2085,8 +2085,10 @@ func_params = NULL; } - 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); } http://cvs.php.net/diff.php/php-src/ext/standard/tests/general_functions/bug31190.phpt?r1=1.1&r2=1.2&ty=u Index: php-src/ext/standard/tests/general_functions/bug31190.phpt diff -u /dev/null php-src/ext/standard/tests/general_functions/bug31190.phpt:1.2 --- /dev/null Tue Jan 18 05:38:04 2005 +++ php-src/ext/standard/tests/general_functions/bug31190.phpt Tue Jan 18 05:38:04 2005 @@ -0,0 +1,26 @@ +--TEST-- +bug #31190 (exception in call_user_func_array()) +--FILE-- +<?php + +class test { + function throwException() { throw new Exception("Hello World!\n"); +} } + +$array = array(new test(), 'throwException'); +try { + call_user_func($array, 1, 2); +} catch (Exception $e) { + echo $e->getMessage(); +} + +try { + call_user_func_array($array, array(1, 2)); +} catch (Exception $e) { + echo $e->getMessage(); +} +?> +--EXPECT-- +Hello World! +Hello World! +
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php