summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2009-06-18 13:46:16 +0000
committerScott MacVicar <scottmac@php.net>2009-06-18 13:46:16 +0000
commit8e3aebd5504cac42d296b16b8ed1b210de67427a (patch)
tree54ea9881b9f9ded2ef648aef1b9bb26b20199d64 /Zend/zend_object_handlers.c
parentb2d3c2bf187eae76c26fecaf13de9d5249ce2ecc (diff)
downloadphp-git-8e3aebd5504cac42d296b16b8ed1b210de67427a.tar.gz
Fix bug #48215 - Calling a method with the same name as the parent class calls the constructor instead.
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 0e0b976032..6848977ae3 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -28,6 +28,7 @@
#include "zend_object_handlers.h"
#include "zend_interfaces.h"
#include "zend_closures.h"
+#include "zend_compile.h"
#define DEBUG_OBJECT_HANDLERS 0
@@ -941,7 +942,8 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
if (function_name_strlen == ce->name_length && ce->constructor) {
lc_class_name = zend_str_tolower_dup(ce->name, ce->name_length);
- if (!memcmp(lc_class_name, function_name_strval, function_name_strlen)) {
+ /* Only change the method to the constructor if a __construct() method doesn't exist */
+ if (!memcmp(lc_class_name, function_name_strval, function_name_strlen) && memcmp(ce->constructor->common.function_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
fbc = ce->constructor;
}
efree(lc_class_name);