felipe                                   Fri, 14 May 2010 23:48:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299395

Log:
- Fixed bug #51827 (Bad warning when register_shutdown_function called with 
wrong num of parameters)

Bug: http://bugs.php.net/51827 (Open) Bad warning when 
register_shutdown_function called with wrong num of parameters
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/Zend/tests/bug51827.phpt
    U   php/php-src/branches/PHP_5_3/Zend/zend_API.c
    A   php/php-src/trunk/Zend/tests/bug51827.phpt
    U   php/php-src/trunk/Zend/zend_API.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-14 20:39:08 UTC (rev 299394)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-14 23:48:03 UTC (rev 299395)
@@ -54,6 +54,8 @@
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)

+- Fixed bug #51827 (Bad warning when register_shutdown_function called with
+  wrong num of parameters). (Felipe)
 - Fixed bug #51791 (constant() aborts execution when fail to check undefined
   constant). (Felipe)
 - Fixed bug #51732 (Fileinfo __construct or open does not work with NULL).

Added: php/php-src/branches/PHP_5_3/Zend/tests/bug51827.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug51827.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug51827.phpt       2010-05-14 
23:48:03 UTC (rev 299395)
@@ -0,0 +1,19 @@
+--TEST--
+Bug #51827 (Bad warning when register_shutdown_function called with wrong num 
of parameters)
+--FILE--
+<?php
+
+
+function abc() {
+       var_dump(1);
+}
+
+register_shutdown_function('timE');
+register_shutdown_function('ABC');
+register_shutdown_function('exploDe');
+
+?>
+--EXPECTF--
+int(1)
+
+Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d


Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug51827.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/Zend/zend_API.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_API.c        2010-05-14 20:39:08 UTC 
(rev 299394)
+++ php/php-src/branches/PHP_5_3/Zend/zend_API.c        2010-05-14 23:48:03 UTC 
(rev 299395)
@@ -721,7 +721,7 @@
                                                zend_error(E_WARNING, 
"%s%s%s(): only one varargs specifier (* or +) is permitted",
                                                                class_name,
                                                                class_name[0] ? 
"::" : "",
-                                                               
get_active_function_name(TSRMLS_C));
+                                                               
active_function->common.function_name);
                                        }
                                        return FAILURE;
                                }
@@ -741,7 +741,7 @@
                                        zend_error(E_WARNING, "%s%s%s(): bad 
type specifier while parsing parameters",
                                                        class_name,
                                                        class_name[0] ? "::" : 
"",
-                                                       
get_active_function_name(TSRMLS_C));
+                                                       
active_function->common.function_name);
                                }
                                return FAILURE;
                }
@@ -764,7 +764,7 @@
                        zend_error(E_WARNING, "%s%s%s() expects %s %d 
parameter%s, %d given",
                                        class_name,
                                        class_name[0] ? "::" : "",
-                                       get_active_function_name(TSRMLS_C),
+                                       active_function->common.function_name,
                                        min_num_args == max_num_args ? 
"exactly" : num_args < min_num_args ? "at least" : "at most",
                                        num_args < min_num_args ? min_num_args 
: max_num_args,
                                        (num_args < min_num_args ? min_num_args 
: max_num_args) == 1 ? "" : "s",

Added: php/php-src/trunk/Zend/tests/bug51827.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug51827.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug51827.phpt  2010-05-14 23:48:03 UTC (rev 
299395)
@@ -0,0 +1,19 @@
+--TEST--
+Bug #51827 (Bad warning when register_shutdown_function called with wrong num 
of parameters)
+--FILE--
+<?php
+
+
+function abc() {
+       var_dump(1);
+}
+
+register_shutdown_function('timE');
+register_shutdown_function('ABC');
+register_shutdown_function('exploDe');
+
+?>
+--EXPECTF--
+int(1)
+
+Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d


Property changes on: php/php-src/trunk/Zend/tests/bug51827.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/Zend/zend_API.c
===================================================================
--- php/php-src/trunk/Zend/zend_API.c   2010-05-14 20:39:08 UTC (rev 299394)
+++ php/php-src/trunk/Zend/zend_API.c   2010-05-14 23:48:03 UTC (rev 299395)
@@ -724,7 +724,7 @@
                                                zend_error(E_WARNING, 
"%s%s%s(): only one varargs specifier (* or +) is permitted",
                                                                class_name,
                                                                class_name[0] ? 
"::" : "",
-                                                               
get_active_function_name(TSRMLS_C));
+                                                               
active_function->common.function_name);
                                        }
                                        return FAILURE;
                                }
@@ -744,7 +744,7 @@
                                        zend_error(E_WARNING, "%s%s%s(): bad 
type specifier while parsing parameters",
                                                        class_name,
                                                        class_name[0] ? "::" : 
"",
-                                                       
get_active_function_name(TSRMLS_C));
+                                                       
active_function->common.function_name);
                                }
                                return FAILURE;
                }
@@ -767,7 +767,7 @@
                        zend_error(E_WARNING, "%s%s%s() expects %s %d 
parameter%s, %d given",
                                        class_name,
                                        class_name[0] ? "::" : "",
-                                       get_active_function_name(TSRMLS_C),
+                                       active_function->common.function_name,
                                        min_num_args == max_num_args ? 
"exactly" : num_args < min_num_args ? "at least" : "at most",
                                        num_args < min_num_args ? min_num_args 
: max_num_args,
                                        (num_args < min_num_args ? min_num_args 
: max_num_args) == 1 ? "" : "s",

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

Reply via email to