]> granicus.if.org Git - php/commitdiff
- Fixed bug #52160 (Invalid E_STRICT redefined constructor error)
authorFelipe Pena <felipe@php.net>
Sat, 26 Jun 2010 19:19:16 +0000 (19:19 +0000)
committerFelipe Pena <felipe@php.net>
Sat, 26 Jun 2010 19:19:16 +0000 (19:19 +0000)
NEWS
Zend/tests/bug35634.phpt
Zend/tests/bug48215.phpt
Zend/tests/bug48215_2.phpt
Zend/tests/bug52160.phpt [new file with mode: 0644]
Zend/tests/objects_011.phpt
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 3e69fec80ea821a1dfc118f519d8e84e75e00ec2..73345993a052706f218d5fb90d66bdb30fa9b5c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PHP                                                                        NEWS
   function aliases). (Felipe)
 - Fixed bug #52162 (custom request header variables with numbers are removed). 
   (Sriram Natarajan)
+- Fixed bug #52160 (Invalid E_STRICT redefined constructor error). (Felipe)
 - Fixed bug #52138 (Constants are parsed into the ini file for section names).
   (Felipe)
 - Fixed bug #52115 (mysqli_result::fetch_all returns null, not an empty array).
index 9681b6ad406b4b8bf5af910b03fe87c2f725bd88..1437017a3b66e3afb68214d46e3499dc831507ad 100755 (executable)
@@ -30,7 +30,9 @@ if (defined("pass3")) {
   set_error_handler('errorHandler');
   define("pass2", 1);
   include(__FILE__);
+  print "ok\n";
 }
+
 ?>
---EXPECTF--
-Error: Redefining already defined constructor for class TestClass (%sbug35634.php:12)
+--EXPECT--
+ok
index 99c4dd289b4c701058ccca220c7ea1d71648d3be..2e156ad7f35a8c4c7aabc54df2c5e3ebb4824863 100644 (file)
@@ -29,8 +29,6 @@ $b->A();
 ?>
 ===DONE===
 --EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class A in %s on line %d
 B::__construct
 A::__construct
 B::A
index 30f0734ace633b0fb3a4ae268107415192f7e263..199a252208d058dc36f3b647ea42c693ef37b3f4 100644 (file)
@@ -16,7 +16,4 @@ $c = new c();
 ?>
 ===DONE===
 --EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class a in %s on line %d
-
 Fatal error: Call to undefined method b::b() in %s on line %d
diff --git a/Zend/tests/bug52160.phpt b/Zend/tests/bug52160.phpt
new file mode 100644 (file)
index 0000000..c85d2f0
--- /dev/null
@@ -0,0 +1,34 @@
+--TEST--
+Bug #52160 (Invalid E_STRICT redefined constructor error)
+--FILE--
+<?php
+
+class bar {
+       function __construct() { }
+       static function bar() {
+               var_dump(1);
+       }
+}
+
+bar::bar();
+
+class foo {
+       static function foo() {
+               var_dump(2);
+       }
+       function __construct() { }
+}
+
+foo::foo();
+
+class baz {
+       static function baz() {
+               var_dump(3);
+       }
+}
+
+?>
+--EXPECTF--
+Strict Standards: Redefining already defined constructor for class foo in %s on line %d
+
+Fatal error: Constructor baz::baz() cannot be static in %s on line %d
index eb1fc0c1f0a7be8d8c90b3cc3e6dc1d54eaf8ede..c7d1e876f541cdae444477cffaf5f49b72f43d63 100644 (file)
@@ -14,6 +14,5 @@ class test {
 
 echo "Done\n";
 ?>
---EXPECTF--    
-Strict Standards: Redefining already defined constructor for class test in %s on line %d
+--EXPECT--
 Done
index ddae339c3b70307a70170ebf0dfd92884f6cd1bb..118f813e2a861c528d8de9abf82bffcf8afb2db7 100644 (file)
@@ -1277,9 +1277,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
                        /* Improve after RC: cache the lowercase class name */
 
                        if ((CG(active_class_entry)->name_length == name_len) && (!memcmp(class_lcname, lcname, name_len))) {
-                               if (CG(active_class_entry)->constructor) {
-                                       zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
-                               } else {
+                               if (!CG(active_class_entry)->constructor) {
                                        CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
                                }
                        } else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {