cvs: ZendEngine2 / zend_execute.c zend_execute.h zend_execute_API.c
| From: | Andi Gutmans | Date: | Sun, 16 Jun 2002 18:25:05 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c zend_execute.h zend_execute_API.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-169@lists.php.net to get a copy of this message | ||
andi Sun Jun 16 14:25:05 2002 EDT
Modified files:
/ZendEngine2 zend_execute.c zend_execute.h zend_execute_API.c
Log:
- Fix bug in class constants
- Start centralizing main class lookups. This will help implement
- __autload()
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.345 ZendEngine2/zend_execute.c:1.346
--- ZendEngine2/zend_execute.c:1.345 Tue Jun 11 13:33:53 2002
+++ ZendEngine2/zend_execute.c Sun Jun 16 14:25:05 2002
@@ -1555,7 +1555,7 @@
{
zval **value_ptr_ptr = get_zval_ptr_ptr(&EX(opline)->op2, EX(Ts), BP_VAR_W);
- if (value_ptr_ptr = &EX(Ts)[EX(opline)->op2.u.var].var.ptr) {
+ if (value_ptr_ptr = EX(Ts)[EX(opline)->op2.u.var].var.ptr_ptr) {
if (!(*value_ptr_ptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(*value_ptr_ptr)
|| (*value_ptr_ptr)->refcount == 1)))
{
zend_error(E_ERROR, "Can't assign by reference non-referencable value!");
@@ -1850,7 +1850,7 @@
class_name_strlen = tmp.value.str.len;
}
- if (zend_hash_find(EG(class_table), class_name_strval, class_name_strlen+1, (void **)
&pce) == FAILURE) {
+ if (zend_lookup_class(class_name_strval, class_name_strlen, &pce TSRMLS_CC) == FAILURE) {
zend_error(E_ERROR, "Class '%s' not found", class_name_strval);
} else {
EX(Ts)[EX(opline)->result.u.var].EA.class_entry = *pce;
Index: ZendEngine2/zend_execute.h
diff -u ZendEngine2/zend_execute.h:1.46 ZendEngine2/zend_execute.h:1.47
--- ZendEngine2/zend_execute.h:1.46 Mon May 20 03:17:30 2002
+++ ZendEngine2/zend_execute.h Sun Jun 16 14:25:05 2002
@@ -64,7 +64,7 @@
FREE_ZVAL(p);
}
}
-
+ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
static inline int i_zend_is_true(zval *op)
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.163 ZendEngine2/zend_execute_API.c:1.164
--- ZendEngine2/zend_execute_API.c:1.163 Fri May 31 08:09:19 2002
+++ ZendEngine2/zend_execute_API.c Sun Jun 16 14:25:05 2002
@@ -331,12 +331,12 @@
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 @@
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 @@
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;
@@ -635,6 +635,11 @@
EG(This) = current_this;
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);
}