summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug52051.phpt27
-rw-r--r--Zend/zend_object_handlers.c2
3 files changed, 30 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a8e300fd56..f9a3b797fc 100644
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,8 @@ PHP NEWS
- Fixed bug #52060 (Memory leak when passing a closure to method_exists()).
(Felipe)
- Fixed bug #52057 (ReflectionClass fails on Closure class). (Felipe)
+- Fixed bug #52051 (handling of case sensitivity of old-style constructors
+ changed in 5.3+). (Felipe)
- Fixed bug #52019 (make lcov doesn't support TESTS variable anymore). (Patrick)
- Fixed bug #52010 (open_basedir restrictions mismatch on vacuum command).
(Ilia)
diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt
new file mode 100644
index 0000000000..e8a4f49e3c
--- /dev/null
+++ b/Zend/tests/bug52051.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #52051 (handling of case sensitivity of old-style constructors changed in 5.3+)
+--FILE--
+<?php
+
+class AA {
+ function AA() { echo "foo\n"; }
+}
+class bb extends AA {}
+class CC extends bb {
+ function CC() { parent::bb(); }
+}
+new CC();
+
+class A {
+ function A() { echo "bar\n"; }
+}
+class B extends A {}
+class C extends B {
+ function C() { parent::B(); }
+}
+new C();
+
+?>
+--EXPECT--
+foo
+bar
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 1424a111c4..1399ef50d5 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -945,7 +945,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
/* Only change the method to the constructor if the constructor isn't called __construct
* we check for __ so we can be binary safe for lowering, we should use ZEND_CONSTRUCTOR_FUNC_NAME
*/
- if (!memcmp(lc_class_name, function_name_strval, function_name_strlen) && memcmp(ce->constructor->common.function_name, "__", sizeof("__") - 1)) {
+ if (!memcmp(lc_class_name, lc_function_name, function_name_strlen) && memcmp(ce->constructor->common.function_name, "__", sizeof("__") - 1)) {
fbc = ce->constructor;
}
efree(lc_class_name);