cvs: ZendEngine2 / zend_API.c zend_execute_API.c

From: Date: Mon, 09 Jun 2003 10:55:37 +0000
Subject: cvs: ZendEngine2 / zend_API.c zend_execute_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1358@lists.php.net to get a copy of this message
stas Mon Jun 9 06:55:37 2003 EDT Modified files: /ZendEngine2 zend_API.c zend_execute_API.c Log: Support 'self' and 'parent' in call_user_func() Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.175 ZendEngine2/zend_API.c:1.176 --- ZendEngine2/zend_API.c:1.175 Wed Jun 4 04:16:55 2003 +++ ZendEngine2/zend_API.c Mon Jun 9 06:55:37 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.175 2003/06/04 08:16:55 stas Exp $ */ +/* $Id: zend_API.c,v 1.176 2003/06/09 10:55:37 stas Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -1504,7 +1504,12 @@ return 1; lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { + + if(EG(active_op_array) && strcmp(lcname, "self") == 0) { + ce = EG(active_op_array)->scope; + } else if(strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) { + ce = EG(active_op_array)->scope->parent; + } else if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.206 ZendEngine2/zend_execute_API.c:1.207 --- ZendEngine2/zend_execute_API.c:1.206 Mon Jun 2 08:13:11 2003 +++ ZendEngine2/zend_execute_API.c Mon Jun 9 06:55:37 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.206 2003/06/02 12:13:11 stas Exp $ */ +/* $Id: zend_execute_API.c,v 1.207 2003/06/09 10:55:37 stas Exp $ */ #include <stdio.h> #include <signal.h> @@ -583,10 +583,18 @@ } else if (Z_TYPE_PP(object_pp) == IS_STRING) { zend_class_entry **ce; char *lc_class; - int found; + int found = FAILURE; lc_class = zend_str_tolower_dup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp)); - found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC); + if(EG(active_op_array) && strcmp(lc_class, "self") == 0) { + ce = &(EG(active_op_array)->scope); + found = (*ce != NULL?SUCCESS:FAILURE); + } else if(strcmp(lc_class, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) { + ce = &(EG(active_op_array)->scope->parent); + found = (*ce != NULL?SUCCESS:FAILURE); + } else { + found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC); + } efree(lc_class); if (found == FAILURE) return FAILURE;

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