mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
Fixed bug #31190 (exceptions in call_user_func_array())
This commit is contained in:
parent
5c98efddae
commit
ea6ea21939
@ -2085,8 +2085,10 @@ PHP_FUNCTION(call_user_func_array)
|
|||||||
func_params = NULL;
|
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) {
|
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);
|
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", name);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", name);
|
||||||
}
|
}
|
||||||
|
26
ext/standard/tests/general_functions/bug31190.phpt
Normal file
26
ext/standard/tests/general_functions/bug31190.phpt
Normal 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!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user