helly           Sat Dec 27 16:10:35 2003 EDT

  Added files:                 
    /php-src/ext/standard/tests/general_functions       bug25038.phpt 

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
    /php-src    NEWS 
  Log:
  Bugfix #25038 (call_user_func issues warning if function throws exception)
  
  
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.649 
php-src/ext/standard/basic_functions.c:1.650
--- php-src/ext/standard/basic_functions.c:1.649        Mon Dec 22 11:00:52 2003
+++ php-src/ext/standard/basic_functions.c      Sat Dec 27 16:10:28 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.649 2003/12/22 16:00:52 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.650 2003/12/27 21:10:28 helly Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1830,8 +1830,10 @@
                RETURN_NULL();
        }
 
-       if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, 
argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
-               COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+       if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, 
argc-1, params+1, 0, NULL TSRMLS_CC) == SUCCESS) {
+               if (retval_ptr) {
+                       COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+               }
        } else {
                if (argc > 1) {
                        SEPARATE_ZVAL(params[1]);
Index: php-src/NEWS
diff -u php-src/NEWS:1.1557 php-src/NEWS:1.1558
--- php-src/NEWS:1.1557 Sat Dec 27 05:33:26 2003
+++ php-src/NEWS        Sat Dec 27 16:10:34 2003
@@ -11,6 +11,8 @@
   (Ilia)
 - Fixed bug #26680 (Added version check in mysqli_report_index) (Georg)
 - Fixed bug #26675 (Segfault on ArrayAccess use). (Marcus)
+- Fixed bug #25038 (call_user_func issues warning if function throws 
+  exception). (Marcus)
 
 21 Dec 2003, PHP 5 Beta 3
 - Bundled new tidy extension (John, Wez)

Index: php-src/ext/standard/tests/general_functions/bug25038.phpt
+++ php-src/ext/standard/tests/general_functions/bug25038.phpt
--TEST--
Bug #25038 (call_user_func issues warning if function throws exception)
--FILE--
<?php

function bar($x='no argument')
{
    throw new Exception("This is an exception from bar({$x}).");
}
try
{
        bar('first try');
}
catch (Exception $e)
{
        print $e->getMessage()."\n";
}
try
{
        call_user_func('bar','second try');
}
catch (Exception $e)
{
        print $e->getMessage()."\n";
}

?>
===DONE===
--EXPECT--
This is an exception from bar(first try).
This is an exception from bar(second try).
===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to