mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fixed bug #51008 (Zend/tests/bug45877.phpt fails)
This commit is contained in:
parent
a9da84800e
commit
fa3f0bb63f
@ -817,7 +817,7 @@ void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS
|
||||
SET_NODE(opline.op1, parent);
|
||||
SET_NODE(opline.op2, dim);
|
||||
if (opline.op2_type == IS_CONST && Z_TYPE(CONSTANT(opline.op2.constant)) == IS_STRING) {
|
||||
long index;
|
||||
ulong index;
|
||||
int numeric = 0;
|
||||
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline.op2.constant)), Z_STRLEN(CONSTANT(opline.op2.constant))+1, index, numeric = 1);
|
||||
@ -5192,7 +5192,7 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z
|
||||
if (offset) {
|
||||
SET_NODE(opline->op2, offset);
|
||||
if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
|
||||
long index;
|
||||
ulong index;
|
||||
int numeric = 0;
|
||||
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1);
|
||||
@ -5224,7 +5224,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of
|
||||
if (offset) {
|
||||
SET_NODE(opline->op2, offset);
|
||||
if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
|
||||
long index;
|
||||
ulong index;
|
||||
int numeric = 0;
|
||||
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1);
|
||||
|
@ -1003,7 +1003,6 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva
|
||||
zval **retval;
|
||||
char *offset_key;
|
||||
int offset_key_length;
|
||||
long index;
|
||||
ulong hval;
|
||||
|
||||
switch (dim->type) {
|
||||
@ -1021,7 +1020,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zva
|
||||
if (dim_type == IS_CONST) {
|
||||
hval = Z_HASH_P(dim);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, index, goto num_index);
|
||||
ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, hval, goto num_index);
|
||||
if (IS_INTERNED(offset_key)) {
|
||||
hval = INTERNED_HASH(offset_key);
|
||||
} else {
|
||||
@ -1052,32 +1051,32 @@ fetch_string_dim:
|
||||
}
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
index = zend_dval_to_lval(Z_DVAL_P(dim));
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(dim));
|
||||
goto num_index;
|
||||
case IS_RESOURCE:
|
||||
zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim));
|
||||
/* Fall Through */
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
index = Z_LVAL_P(dim);
|
||||
hval = Z_LVAL_P(dim);
|
||||
num_index:
|
||||
if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
|
||||
if (zend_hash_index_find(ht, hval, (void **) &retval) == FAILURE) {
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", index);
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_UNSET:
|
||||
case BP_VAR_IS:
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", index);
|
||||
zend_error(E_NOTICE,"Undefined offset: %ld", hval);
|
||||
/* break missing intentionally */
|
||||
case BP_VAR_W: {
|
||||
zval *new_zval = &EG(uninitialized_zval);
|
||||
|
||||
Z_ADDREF_P(new_zval);
|
||||
zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval);
|
||||
zend_hash_index_update(ht, hval, &new_zval, sizeof(zval *), (void **) &retval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -327,11 +327,11 @@ END_EXTERN_C()
|
||||
} \
|
||||
if (tmp == end) { \
|
||||
if (*key == '-') { \
|
||||
idx = -idx; \
|
||||
if (idx > 0) { /* overflow */ \
|
||||
if (idx-1 > LONG_MAX) { /* overflow */ \
|
||||
break; \
|
||||
} \
|
||||
} else if (idx < 0) { /* overflow */ \
|
||||
idx = (ulong)(-(long)idx); \
|
||||
} else if (idx > LONG_MAX) { /* overflow */ \
|
||||
break; \
|
||||
} \
|
||||
func; \
|
||||
@ -340,7 +340,7 @@ END_EXTERN_C()
|
||||
} while (0)
|
||||
|
||||
#define ZEND_HANDLE_NUMERIC(key, length, func) do { \
|
||||
long idx; \
|
||||
ulong idx; \
|
||||
\
|
||||
ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func); \
|
||||
} while (0)
|
||||
|
@ -3490,23 +3490,22 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUS
|
||||
zend_free_op free_op2;
|
||||
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
|
||||
ulong hval;
|
||||
long index;
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
index = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index);
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
index = Z_LVAL_P(offset);
|
||||
hval = Z_LVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index):
|
||||
zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), index, &expr_ptr, sizeof(zval *), NULL);
|
||||
zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, ZEND_VM_C_GOTO(num_index));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index));
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@ -3820,7 +3819,6 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
zval **container;
|
||||
zval *offset;
|
||||
ulong hval;
|
||||
long index;
|
||||
|
||||
SAVE_OPLINE();
|
||||
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
|
||||
@ -3836,14 +3834,14 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
index = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index_dim);
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
ZEND_VM_C_LABEL(num_index_dim):
|
||||
index = Z_LVAL_P(offset);
|
||||
zend_hash_index_del(ht, index);
|
||||
hval = Z_LVAL_P(offset);
|
||||
zend_hash_index_del(ht, hval);
|
||||
break;
|
||||
case IS_STRING:
|
||||
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) {
|
||||
@ -3852,7 +3850,7 @@ ZEND_VM_C_LABEL(num_index_dim):
|
||||
if (OP2_TYPE == IS_CONST) {
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, ZEND_VM_C_GOTO(num_index_dim));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim));
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
} else {
|
||||
@ -4346,7 +4344,6 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
ulong hval;
|
||||
long index;
|
||||
zval *offset;
|
||||
|
||||
SAVE_OPLINE();
|
||||
@ -4362,14 +4359,14 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
|
||||
|
||||
switch (Z_TYPE_P(offset)) {
|
||||
case IS_DOUBLE:
|
||||
index = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
hval = zend_dval_to_lval(Z_DVAL_P(offset));
|
||||
ZEND_VM_C_GOTO(num_index_prop);
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
index = Z_LVAL_P(offset);
|
||||
hval = Z_LVAL_P(offset);
|
||||
ZEND_VM_C_LABEL(num_index_prop):
|
||||
if (zend_hash_index_find(ht, index, (void **) &value) == SUCCESS) {
|
||||
if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) {
|
||||
isset = 1;
|
||||
}
|
||||
break;
|
||||
@ -4378,7 +4375,7 @@ ZEND_VM_C_LABEL(num_index_prop):
|
||||
hval = Z_HASH_P(offset);
|
||||
} else {
|
||||
if (!prop_dim) {
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, index, ZEND_VM_C_GOTO(num_index_prop));
|
||||
ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop));
|
||||
}
|
||||
if (IS_INTERNED(Z_STRVAL_P(offset))) {
|
||||
hval = INTERNED_HASH(Z_STRVAL_P(offset));
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user