summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-06-26 19:19:16 +0000
committerFelipe Pena <felipe@php.net>2010-06-26 19:19:16 +0000
commiteb5e97adf5df1d3183d858a7b78d478f8b9a3ad2 (patch)
tree9f810382bdee76d04f6fbb282e4b5a13eeef1d74
parent419f589580662b464aeaa56a5a055935e2113f95 (diff)
downloadphp-git-eb5e97adf5df1d3183d858a7b78d478f8b9a3ad2.tar.gz
- Fixed bug #52160 (Invalid E_STRICT redefined constructor error)
-rw-r--r--NEWS1
-rwxr-xr-xZend/tests/bug35634.phpt6
-rw-r--r--Zend/tests/bug48215.phpt2
-rw-r--r--Zend/tests/bug48215_2.phpt3
-rw-r--r--Zend/tests/bug52160.phpt34
-rw-r--r--Zend/tests/objects_011.phpt3
-rw-r--r--Zend/zend_compile.c4
7 files changed, 41 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 3e69fec80e..73345993a0 100644
--- 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).
diff --git a/Zend/tests/bug35634.phpt b/Zend/tests/bug35634.phpt
index 9681b6ad40..1437017a3b 100755
--- a/Zend/tests/bug35634.phpt
+++ b/Zend/tests/bug35634.phpt
@@ -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
diff --git a/Zend/tests/bug48215.phpt b/Zend/tests/bug48215.phpt
index 99c4dd289b..2e156ad7f3 100644
--- a/Zend/tests/bug48215.phpt
+++ b/Zend/tests/bug48215.phpt
@@ -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
diff --git a/Zend/tests/bug48215_2.phpt b/Zend/tests/bug48215_2.phpt
index 30f0734ace..199a252208 100644
--- a/Zend/tests/bug48215_2.phpt
+++ b/Zend/tests/bug48215_2.phpt
@@ -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
index 0000000000..c85d2f09af
--- /dev/null
+++ b/Zend/tests/bug52160.phpt
@@ -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
diff --git a/Zend/tests/objects_011.phpt b/Zend/tests/objects_011.phpt
index eb1fc0c1f0..c7d1e876f5 100644
--- a/Zend/tests/objects_011.phpt
+++ b/Zend/tests/objects_011.phpt
@@ -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
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index ddae339c3b..118f813e2a 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -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)))) {