Fixed bug #31190 (exceptions in call_user_func_array())

This commit is contained in:
Dmitry Stogov 2005-01-18 10:38:04 +00:00
parent 5c98efddae
commit ea6ea21939
2 changed files with 30 additions and 2 deletions

View File

@ -2085,8 +2085,10 @@ PHP_FUNCTION(call_user_func_array)
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);
}

View File

@ -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!