mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Do not edit the zval cause it might be in shared memory
This commit is contained in:
parent
c147d90dbf
commit
925412ee1c
@ -303,6 +303,8 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
|
||||
{
|
||||
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
|
||||
zval **retval;
|
||||
char *key;
|
||||
uint len;
|
||||
long index;
|
||||
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
|
||||
|
||||
@ -315,12 +317,12 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
|
||||
return &EG(error_zval_ptr);;
|
||||
}
|
||||
|
||||
switch(Z_TYPE_P(offset)) {
|
||||
case IS_NULL:
|
||||
Z_STRVAL_P(offset) = "";
|
||||
Z_STRLEN_P(offset) = 0;
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_STRING:
|
||||
if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) {
|
||||
key = Z_STRVAL_P(offset);
|
||||
len = Z_STRLEN_P(offset) + 1;
|
||||
string_offest:
|
||||
if (zend_symtable_find(ht, key, len, (void **) &retval) == FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset));
|
||||
@ -333,11 +335,15 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object,
|
||||
case BP_VAR_W: {
|
||||
zval *value;
|
||||
ALLOC_INIT_ZVAL(value);
|
||||
zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval);
|
||||
zend_symtable_update(ht, key, len, (void**)&value, sizeof(void*), (void **)&retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
case IS_NULL:
|
||||
key = "";
|
||||
len = 1;
|
||||
goto string_offest;
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset));
|
||||
case IS_DOUBLE:
|
||||
|
Loading…
Reference in New Issue
Block a user