summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-04-20 07:30:38 +0000
committerDmitry Stogov <dmitry@php.net>2006-04-20 07:30:38 +0000
commitbdef85af21146b462ebf8e13cf3a34162f02d7bd (patch)
tree87609070f12097383fb4b7da05eacfcd8be29110 /Zend/zend_API.c
parent09dec6267263b5f74bb27e30ab9d03f7f7f2aced (diff)
downloadphp-git-bdef85af21146b462ebf8e13cf3a34162f02d7bd.tar.gz
Fixed bug #37138 (__autoload tries to load callback'ed self and parent)
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 71f3a504ff..0a9b8213a0 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2039,18 +2039,16 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
clen = colon - Z_STRVAL_P(callable);
mlen = Z_STRLEN_P(callable) - clen - 2;
- if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
+ lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
+ /* caution: lcname is not '\0' terminated */
+ if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
+ *ce_ptr = EG(scope);
+ } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
+ *ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
+ } else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
*ce_ptr = *pce;
- } else {
- lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
- /* caution: lcname is not '\0' terminated */
- if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
- *ce_ptr = EG(scope);
- } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
- *ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
- }
- efree(lcname);
}
+ efree(lcname);
if (!*ce_ptr) {
return 0;
}
@@ -2179,17 +2177,15 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
return 1;
}
- if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
+ lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
+ if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
+ ce = EG(active_op_array)->scope;
+ } else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
+ ce = EG(active_op_array)->scope->parent;
+ } else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
- } else if (EG(active_op_array)) {
- lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
- if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
- ce = EG(active_op_array)->scope;
- } else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
- ce = EG(active_op_array)->scope->parent;
- }
- efree(lcname);
}
+ efree(lcname);
} else {
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */