felipe                                   Sat, 26 Jun 2010 19:19:16 +0000

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

Log:
- Fixed bug #52160 (Invalid E_STRICT redefined constructor error)

Bug: http://bugs.php.net/52160 (error getting bug information)
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/Zend/tests/bug35634.phpt
    A   php/php-src/branches/PHP_5_2/Zend/tests/bug52160.phpt
    U   php/php-src/branches/PHP_5_2/Zend/tests/objects_011.phpt
    U   php/php-src/branches/PHP_5_2/Zend/zend_compile.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/tests/bug35634.phpt
    U   php/php-src/branches/PHP_5_3/Zend/tests/bug48215.phpt
    U   php/php-src/branches/PHP_5_3/Zend/tests/bug48215_2.phpt
    A   php/php-src/branches/PHP_5_3/Zend/tests/bug52160.phpt
    U   php/php-src/branches/PHP_5_3/Zend/tests/objects_011.phpt
    U   php/php-src/branches/PHP_5_3/Zend/zend_compile.c
    U   php/php-src/trunk/Zend/tests/bug35634.phpt
    U   php/php-src/trunk/Zend/tests/bug48215.phpt
    U   php/php-src/trunk/Zend/tests/bug48215_2.phpt
    A   php/php-src/trunk/Zend/tests/bug52160.phpt
    U   php/php-src/trunk/Zend/tests/objects_011.phpt
    U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_2/NEWS	2010-06-26 19:19:16 UTC (rev 300768)
@@ -5,6 +5,7 @@
   be set). (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 #52061 (memory_limit above 2G). (Felipe)
 - Fixed bug #52010 (open_basedir restrictions mismatch on vacuum command).
   (Ilia, Felipe)

Modified: php/php-src/branches/PHP_5_2/Zend/tests/bug35634.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/bug35634.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_2/Zend/tests/bug35634.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -30,7 +30,9 @@
   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

Added: php/php-src/branches/PHP_5_2/Zend/tests/bug52160.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/bug52160.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_2/Zend/tests/bug52160.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -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


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

Modified: php/php-src/branches/PHP_5_2/Zend/tests/objects_011.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/objects_011.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_2/Zend/tests/objects_011.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -14,6 +14,5 @@

 echo "Done\n";
 ?>
---EXPECTF--
-Strict Standards: Redefining already defined constructor for class test in %s on line %d
+--EXPECT--
 Done

Modified: php/php-src/branches/PHP_5_2/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_compile.c	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_2/Zend/zend_compile.c	2010-06-26 19:19:16 UTC (rev 300768)
@@ -1175,9 +1175,7 @@
 			/* Improve after RC: cache the lowercase class name */

 			if ((short_class_name_length == name_len) && (!memcmp(short_class_name, 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)))) {

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-06-26 19:19:16 UTC (rev 300768)
@@ -10,6 +10,7 @@
   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).

Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug35634.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug35634.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug35634.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -30,7 +30,9 @@
   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

Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug48215.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug48215.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug48215.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -29,8 +29,6 @@
 ?>
 ===DONE===
 --EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class A in %s on line %d
 B::__construct
 A::__construct
 B::A

Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug48215_2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug48215_2.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug48215_2.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -16,7 +16,4 @@
 ?>
 ===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

Added: php/php-src/branches/PHP_5_3/Zend/tests/bug52160.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug52160.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug52160.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -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


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

Modified: php/php-src/branches/PHP_5_3/Zend/tests/objects_011.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/objects_011.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/Zend/tests/objects_011.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -14,6 +14,5 @@

 echo "Done\n";
 ?>
---EXPECTF--
-Strict Standards: Redefining already defined constructor for class test in %s on line %d
+--EXPECT--
 Done

Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_compile.c	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c	2010-06-26 19:19:16 UTC (rev 300768)
@@ -1277,9 +1277,7 @@
 			/* 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)))) {

Modified: php/php-src/trunk/Zend/tests/bug35634.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug35634.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/trunk/Zend/tests/bug35634.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -30,7 +30,9 @@
   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

Modified: php/php-src/trunk/Zend/tests/bug48215.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug48215.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/trunk/Zend/tests/bug48215.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -29,8 +29,6 @@
 ?>
 ===DONE===
 --EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class A in %s on line %d
 B::__construct
 A::__construct
 B::A

Modified: php/php-src/trunk/Zend/tests/bug48215_2.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug48215_2.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/trunk/Zend/tests/bug48215_2.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -16,7 +16,4 @@
 ?>
 ===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

Added: php/php-src/trunk/Zend/tests/bug52160.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug52160.phpt	                        (rev 0)
+++ php/php-src/trunk/Zend/tests/bug52160.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -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


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

Modified: php/php-src/trunk/Zend/tests/objects_011.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/objects_011.phpt	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/trunk/Zend/tests/objects_011.phpt	2010-06-26 19:19:16 UTC (rev 300768)
@@ -14,6 +14,5 @@

 echo "Done\n";
 ?>
---EXPECTF--
-Strict Standards: Redefining already defined constructor for class test in %s on line %d
+--EXPECT--
 Done

Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c	2010-06-26 18:39:54 UTC (rev 300767)
+++ php/php-src/trunk/Zend/zend_compile.c	2010-06-26 19:19:16 UTC (rev 300768)
@@ -1592,9 +1592,7 @@
 			/* Improve after RC: cache the lowercase class name */

 			if ((CG(active_class_entry)->name_length == name_len) && ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT) && (!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)))) {
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to