{
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!");
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;
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");
}
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;
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;
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)
{