dsp             Thu Mar 20 00:52:47 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/standard/tests/general_functions       bug44487.phpt 

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
  Log:
  MFH: 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.725.2.31.2.64.2.22&r2=1.725.2.31.2.64.2.23&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.22 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.23
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.22 Wed Mar 19 
12:42:16 2008
+++ php-src/ext/standard/basic_functions.c      Thu Mar 20 00:52:46 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.22 2008/03/19 12:42:16 tony2001 
Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.23 2008/03/20 00:52:46 dsp Exp $ 
*/
 
 #include "php.h"
 #include "php_streams.h"
@@ -5172,8 +5172,10 @@
 
        convert_to_string(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 
%s()", Z_STRVAL_P(callback));
        }
@@ -5214,8 +5216,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 
%s()", Z_STRVAL_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

Reply via email to