Fix bug #44487 (call_user_method_array issues a warning when throwing an exception).

This commit is contained in:
David Soria Parra 2008-03-20 00:50:47 +00:00
parent 2e390806ab
commit a19e28ece9
2 changed files with 32 additions and 4 deletions

View file

@ -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) {
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 %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) {
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 %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));
} }

View 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