cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c /tests bug42937.phpt php-src NEWS

From: Date: Mon, 12 Nov 2007 09:11:49 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c /tests bug42937.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6150@lists.php.net to get a copy of this message
dmitry Mon Nov 12 09:11:49 2007 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug42937.phpt Modified files: /php-src NEWS /ZendEngine2 zend_object_handlers.c Log: Fixed bug #42937 (__call() method not invoked when methods are called on parent from child class). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1003&r2=1.2027.2.547.2.1004&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1003 php-src/NEWS:1.2027.2.547.2.1004 --- php-src/NEWS:1.2027.2.547.2.1003 Fri Nov 9 09:37:42 2007 +++ php-src/NEWS Mon Nov 12 09:11:48 2007 @@ -5,6 +5,8 @@ - Fixed bug #43201 (Crash on using unitialized vals and __get/__set). (Dmitry) - Fixed bug #43175 (__destruct() throwing an exception with __call() causes segfault). (Dmitry) +- Fixed bug #42937 (__call() method not invoked when methods are called on + parent from child class). (Dmitry) 08 Nov 2007, PHP 5.2.5 - Upgraded PCRE to version 7.3 (Nuno) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.22&r2=1.135.2.6.2.23&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.23 --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.22 Tue Jul 24 11:39:55 2007 +++ ZendEngine2/zend_object_handlers.c Mon Nov 12 09:11:49 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.22 2007/07/24 11:39:55 dmitry Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.23 2007/11/12 09:11:49 dmitry Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -831,12 +831,32 @@ zend_function *fbc; if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { - char *class_name = ce->name; + if (ce->__call && + EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { + zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); - if (!class_name) { - class_name = ""; + call_user_call->type = ZEND_INTERNAL_FUNCTION; + call_user_call->module = ce->module; + call_user_call->handler = zend_std_call_user_call; + call_user_call->arg_info = NULL; + call_user_call->num_args = 0; + call_user_call->scope = ce; + call_user_call->fn_flags = 0; + call_user_call->function_name = estrndup(function_name_strval, function_name_strlen); + call_user_call->pass_rest_by_reference = 0; + call_user_call->return_reference = ZEND_RETURN_VALUE; + + return (union _zend_function *)call_user_call; + } else { + char *class_name = ce->name; + + if (!class_name) { + class_name = ""; + } + zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval); } - zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval); } if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { /* No further checks necessary, most common case */ http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug42937.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug42937.phpt +++ ZendEngine2/tests/bug42937.phpt

« previous php.zend-engine.cvs (#6150) next »