cvs: ZendEngine2 / zend_API.c

"Felipe Pena" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsfelipe1212693377@cvsserver>
felipe		Thu Jun  5 19:16:17 2008 UTC

  Modified files:              
    /ZendEngine2	zend_API.c 
  Log:
  - MFB: Fixed bug #45186 (__call depends on __callstatic in class scope)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.472&r2=1.473&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.472 ZendEngine2/zend_API.c:1.473
--- ZendEngine2/zend_API.c:1.472	Tue May 27 10:28:25 2008
+++ ZendEngine2/zend_API.c	Thu Jun  5 19:16:17 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_API.c,v 1.472 2008/05/27 10:28:25 mattwil Exp $ */
+/* $Id: zend_API.c,v 1.473 2008/06/05 19:16:17 felipe Exp $ */
 
 #include "zend.h"
 #include "zend_execute.h"
@@ -2802,14 +2802,27 @@
 		if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
 			retval = (*ce_ptr)->__call != NULL;
 			*fptr_ptr = (*ce_ptr)->__call;
-		} else if (!*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__callstatic) {
-			retval = 1;
-			*fptr_ptr = (*ce_ptr)->__callstatic;
 		} else {
-			if (*ce_ptr) {
-				if (error) zend_spprintf(error, 0, "class '%v' does not have a method '%v'", (*ce_ptr)->name, lmname);
-			} else {
-				if (error) zend_spprintf(error, 0, "function '%v' does not exist", lmname);
+			if (!*zobj_ptr_ptr && *ce_ptr && ((*ce_ptr)->__callstatic || (*ce_ptr)->__call)) {
+				if ((*ce_ptr)->__call &&
+					EG(This) &&
+		    		Z_OBJ_HT_P(EG(This))->get_class_entry &&
+		    		instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) {
+					retval = 1;
+					*fptr_ptr = (*ce_ptr)->__call;
+					*zobj_ptr_ptr = &EG(This);
+				} else if ((*ce_ptr)->__callstatic) {
+					retval = 1;
+					*fptr_ptr = (*ce_ptr)->__callstatic;
+				}
+			}
+
+			if (retval == 0) {
+				if (*ce_ptr) {
+					if (error) zend_spprintf(error, 0, "class '%v' does not have a method '%v'", (*ce_ptr)->name, lmname);
+				} else {
+					if (error) zend_spprintf(error, 0, "function '%v' does not exist", lmname);
+				}
 			}
 		}
 	} else {



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.