diff options
-rw-r--r-- | Zend/tests/bug31098.phpt | 14 | ||||
-rw-r--r-- | Zend/zend_execute.c | 23 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 11 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 143 |
4 files changed, 20 insertions, 171 deletions
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt index 8e6c0277f9..fa753678ee 100644 --- a/Zend/tests/bug31098.phpt +++ b/Zend/tests/bug31098.phpt @@ -17,7 +17,7 @@ var_dump(isset($a{'b'})); $simpleString = "Bogus String Text"; echo isset($simpleString->wrong)?"bug\n":"ok\n"; -echo isset($simpleString["wrong"])?"bug\n":"ok\n"; +echo isset($simpleString["wrong"])?"ok\n":"bug\n"; echo isset($simpleString[-1])?"bug\n":"ok\n"; echo isset($simpleString[0])?"ok\n":"bug\n"; echo isset($simpleString["0"])?"ok\n":"bug\n"; @@ -25,18 +25,18 @@ echo isset($simpleString["16"])?"ok\n":"bug\n"; echo isset($simpleString["17"])?"bug\n":"ok\n"; echo isset($simpleString["wrong"][0])?"bug\n":"ok\n"; echo $simpleString->wrong === null?"ok\n":"bug\n"; -echo $simpleString["wrong"] === null?"ok\n":"bug\n"; +echo $simpleString["wrong"] === "B"?"ok\n":"bug\n"; echo $simpleString["0"] === "B"?"ok\n":"bug\n"; $simpleString["wrong"] = "f"; -echo $simpleString["0"] === "B"?"ok\n":"bug\n"; +echo $simpleString["0"] === "f"?"ok\n":"bug\n"; ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) +bool(true) +bool(true) ok ok ok @@ -48,10 +48,6 @@ ok Notice: Trying to get property of non-object in %sbug31098.php on line %d ok - -Notice: Trying to get string index from a string in %sbug31098.php on line %d ok ok - -Notice: Trying to get string index from a string in %sbug31098.php on line %d ok diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 7e75696b93..b249b37871 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1190,28 +1190,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container zend_error_noreturn(E_ERROR, "[] operator not supported for strings"); } - if (Z_TYPE_P(dim) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(dim); - if (is_numeric_string(strval, Z_STRLEN_P(dim), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - dim = &tmp; - } else { - if (type != BP_VAR_IS) { - zend_error(E_NOTICE, "Trying to get string index from a string"); - } - if (result) { - result->var.ptr_ptr = &EG(error_zval_ptr); - PZVAL_LOCK(*result->var.ptr_ptr); - if (type == BP_VAR_R || type == BP_VAR_IS) { - AI_USE_PTR(result->var); - } - } - return; - } - } else if (dim->type != IS_LONG) { + if (dim->type != IS_LONG) { tmp = *dim; zval_copy_ctor(&tmp); convert_to_long(&tmp); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 61c38777c8..304b4e6740 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3193,16 +3193,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST| } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 348fd3a6b7..ebb49e13d6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -9013,16 +9013,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -10337,16 +10328,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(int prop_dim, ZE } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -11682,16 +11664,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(int prop_dim, ZE } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -13157,16 +13130,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -14232,16 +14196,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CONST(int prop_di } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -15190,16 +15145,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -16148,16 +16094,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -17225,16 +17162,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV(int prop_dim, } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -19719,16 +19647,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(int prop_dim, Z } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -21043,16 +20962,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -22388,16 +22298,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int prop_dim, ZEN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -23863,16 +23764,7 @@ static int zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int prop_dim, ZEND } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -30938,16 +30830,7 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ zval tmp; - if (Z_TYPE_P(offset) == IS_STRING) { - char *strval; - long lval; - - strval = Z_STRVAL_P(offset); - if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) { - ZVAL_LONG(&tmp, lval); - offset = &tmp; - } - } else if (offset->type != IS_LONG) { + if (offset->type != IS_LONG) { tmp = *offset; zval_copy_ctor(&tmp); convert_to_long(&tmp); |