mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Fix bug #44487 (call_user_method_array issues a warning when throwing an exception).
This commit is contained in:
parent
2e390806ab
commit
a19e28ece9
2 changed files with 32 additions and 4 deletions
|
@ -5140,8 +5140,10 @@ PHP_FUNCTION(call_user_method)
|
||||||
|
|
||||||
convert_to_text(callback);
|
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) {
|
if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) {
|
||||||
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
if (retval_ptr) {
|
||||||
|
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback));
|
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++;
|
element++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
|
if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) {
|
||||||
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
if (retval_ptr) {
|
||||||
|
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback));
|
||||||
}
|
}
|
||||||
|
|
24
ext/standard/tests/general_functions/bug44487.phpt
Normal file
24
ext/standard/tests/general_functions/bug44487.phpt
Normal file
|
@ -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--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public function test()
|
||||||
|
{
|
||||||
|
print 'test';
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$bar = new Foo();
|
||||||
|
call_user_method_array('test', $bar, array()) ;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
test
|
Loading…
Add table
Add a link
Reference in a new issue