summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-06-16 18:25:05 +0000
committerAndi Gutmans <andi@php.net>2002-06-16 18:25:05 +0000
commit690c85b406559a823063c34fc0fc85bbe6a109dc (patch)
tree2abaae534c77a0b2d44bd3721b5278192e779c56 /Zend/zend_execute_API.c
parent7672dbcdcfa1f319d8429152e28f51066efbbda3 (diff)
downloadphp-git-690c85b406559a823063c34fc0fc85bbe6a109dc.tar.gz
- Fix bug in class constants
- Start centralizing main class lookups. This will help implement - __autload()
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index c007ee8bb5..36596e0228 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -331,12 +331,12 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
if (strchr(p->value.str.val, ':')) {
char *cur, *temp;
char *last;
- zend_class_entry *ce;
+ zend_class_entry **ce;
zval **value;
last = tsrm_strtok_r(p->value.str.val, ":", &temp);
- if (zend_hash_find(EG(class_table), last, strlen(last)+1, (void **)&ce) == FAILURE) {
+ if (zend_lookup_class(last, strlen(last), &ce TSRMLS_CC) == FAILURE) {
zend_error(E_ERROR, "Invalid class! Improve this error message");
}
@@ -347,12 +347,12 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
if (!cur) {
break;
}
- if (zend_hash_find(&ce->class_table, last, strlen(last)+1, (void **)&ce) == FAILURE) {
+ if (zend_hash_find(&(*ce)->class_table, last, strlen(last)+1, (void **)&ce) == FAILURE) {
zend_error(E_ERROR, "Invalid class! Improve this error message");
}
last = cur;
}
- if (zend_hash_find(&ce->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) {
+ if (zend_hash_find(&(*ce)->constants_table, last, strlen(last)+1, (void **) &value) == FAILURE) {
zend_error(E_ERROR, "Invalid class! Improve this error message");
}
const_value = **value;
@@ -500,7 +500,7 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
lc_class = estrndup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
zend_str_tolower(lc_class, Z_STRLEN_PP(object_pp));
- found = zend_hash_find(EG(class_table), lc_class, Z_STRLEN_PP(object_pp) + 1, (void **) &ce);
+ found = zend_lookup_class(lc_class, Z_STRLEN_PP(object_pp), &ce TSRMLS_CC);
efree(lc_class);
if (found == FAILURE)
return FAILURE;
@@ -637,6 +637,11 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
return SUCCESS;
}
+ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
+{
+ return zend_hash_find(EG(class_table), name, name_length+1, (void **) ce);
+}
+
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
{