diff options
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 77 |
1 files changed, 30 insertions, 47 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 53d506f9bd..204d69d4a3 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -666,7 +666,6 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op zval **retval; char *offset_key; int offset_key_length; - long index; switch (dim->type) { case IS_NULL: @@ -674,15 +673,12 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op offset_key_length = 0; goto fetch_string_dim; case IS_STRING: - if (zend_is_numeric_key(dim, &index)) { - goto fetch_int_dim; - } offset_key = dim->value.str.val; offset_key_length = dim->value.str.len; fetch_string_dim: - if (zend_hash_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) { + if (zend_symtable_find(ht, offset_key, offset_key_length+1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: zend_error(E_NOTICE,"Undefined index: %s", offset_key); @@ -706,31 +702,33 @@ fetch_string_dim: case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: - case IS_LONG: - if (dim->type == IS_DOUBLE) { - index = (long)dim->value.dval; - } else { - index = dim->value.lval; - } -fetch_int_dim: - if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); + case IS_LONG: { + long index; - new_zval->refcount++; - zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); + if (dim->type == IS_DOUBLE) { + index = (long)dim->value.dval; + } else { + index = dim->value.lval; + } + if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { + switch (type) { + case BP_VAR_R: + zend_error(E_NOTICE,"Undefined offset: %d", index); + /* break missing intentionally */ + case BP_VAR_IS: + retval = &EG(uninitialized_zval_ptr); + break; + case BP_VAR_RW: + zend_error(E_NOTICE,"Undefined offset: %d", index); + /* break missing intentionally */ + case BP_VAR_W: { + zval *new_zval = &EG(uninitialized_zval); + + new_zval->refcount++; + zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); + } + break; } - break; } } break; @@ -3309,16 +3307,9 @@ inline int zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS) case IS_BOOL: zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); break; - case IS_STRING: { - long idx; - - if (zend_is_numeric_key(offset, &idx)) { - zend_hash_index_update(array_ptr->value.ht, idx, &expr_ptr, sizeof(zval *), NULL); - } else { - zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); - } + case IS_STRING: + zend_symtable_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); break; - } case IS_NULL: zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; @@ -3559,11 +3550,7 @@ int zend_unset_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) zend_hash_index_del(ht, index); break; case IS_STRING: - if (zend_is_numeric_key(offset, &index)) { - zend_hash_index_del(ht, index); - } else { - zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1); - } + zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1); break; case IS_NULL: zend_hash_del(ht, "", sizeof("")); @@ -3778,11 +3765,7 @@ int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) } break; case IS_STRING: - if (zend_is_numeric_key(offset, &index)) { - if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) { - isset = 1; - } - } else if (zend_hash_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) { + if (zend_symtable_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) { isset = 1; } break; |