From 8e3aebd5504cac42d296b16b8ed1b210de67427a Mon Sep 17 00:00:00 2001 From: Scott MacVicar Date: Thu, 18 Jun 2009 13:46:16 +0000 Subject: Fix bug #48215 - Calling a method with the same name as the parent class calls the constructor instead. --- Zend/zend_object_handlers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zend/zend_object_handlers.c') 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); -- cgit v1.2.1