return (op_array->T)++ * sizeof(temp_variable);
}
-static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr name, int name_len)
+static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr name, int name_len TSRMLS_DC)
{
int i = 0;
ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1);
op_array->vars[i].name = name; /* estrndup(name, name_len); */
op_array->vars[i].name_len = name_len;
op_array->vars[i].hash_value = hash_value;
+ op_array->vars[i].fetch_type = zend_u_is_auto_global(type, name, name_len TSRMLS_CC) ? ZEND_FETCH_GLOBAL : ZEND_FETCH_LOCAL;
return i;
}
if (varname->op_type == IS_CONST &&
(Z_TYPE(varname->u.constant) == IS_STRING ||
Z_TYPE(varname->u.constant) == IS_UNICODE) &&
- !zend_u_is_auto_global(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant) TSRMLS_CC) &&
!(Z_UNILEN(varname->u.constant) == (sizeof("this")-1) &&
ZEND_U_EQUAL(Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", sizeof("this")-1)) &&
(CG(active_op_array)->last == 0 ||
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) {
result->op_type = IS_CV;
- result->u.var = lookup_cv(CG(active_op_array), Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant));
+ result->u.var = lookup_cv(CG(active_op_array), Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant) TSRMLS_CC);
result->u.EA.type = 0;
return;
}
if (!*ptr) {
zend_compiled_variable *cv = &CV_DEF_OF(node->u.var);
zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
+ HashTable *symbol_table = (cv->fetch_type == ZEND_FETCH_GLOBAL) ? &EG(symbol_table) : EG(active_symbol_table);
- if (zend_u_hash_quick_find(EG(active_symbol_table), utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
+ if (zend_u_hash_quick_find(symbol_table, utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET:
if (!*ptr) {
zend_compiled_variable *cv = &CV_DEF_OF(node->u.var);
zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING;
+ HashTable *symbol_table = (cv->fetch_type == ZEND_FETCH_GLOBAL) ? &EG(symbol_table) : EG(active_symbol_table);
- if (zend_u_hash_quick_find(EG(active_symbol_table), utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
+ if (zend_u_hash_quick_find(symbol_table, utype, cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
switch (type) {
case BP_VAR_R:
case BP_VAR_UNSET: