dsp Thu Mar 20 00:50:47 2008 UTC
Added files:
/php-src/ext/standard/tests/general_functions bug44487.phpt
Modified files:
/php-src/ext/standard basic_functions.c
Log:
Fix bug #44487 (call_user_method_array issues a warning when throwing an
exception).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.891&r2=1.892&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.891
php-src/ext/standard/basic_functions.c:1.892
--- php-src/ext/standard/basic_functions.c:1.891 Wed Mar 19 12:40:48 2008
+++ php-src/ext/standard/basic_functions.c Thu Mar 20 00:50:47 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.891 2008/03/19 12:40:48 tony2001 Exp $ */
+/* $Id: basic_functions.c,v 1.892 2008/03/20 00:50:47 dsp Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -5140,8 +5140,10 @@
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) {
- COPY_PZVAL_TO_ZVAL(*return_value, 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);
+ }
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call
%R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback));
}
@@ -5183,8 +5185,10 @@
element++;
}
- if (call_user_function_ex(EG(function_table), &object, callback,
&retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS &&
retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, 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);
+ }
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call
%R()", Z_TYPE_P(callback), Z_UNIVAL_P(callback));
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug44487.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/general_functions/bug44487.phpt
+++ php-src/ext/standard/tests/general_functions/bug44487.phpt
--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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php