From: Nikita Popov Date: Sun, 14 Feb 2016 15:49:36 +0000 (+0100) Subject: Fixed bug #53432 X-Git-Tag: php-7.1.0alpha1~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=945a83103de8fbba66bdf643c4701263854c0056;p=php Fixed bug #53432 This change was discussed a while ago in the "negative string offsets" thread. --- diff --git a/NEWS b/NEWS index da7dda7da7..c3a032c9cb 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ PHP NEWS . Change statement and fcall extension handlers to accept frame. (Joe) . Implemented safe execution timeout handling, that prevents random crashes after "Maximum execution time exceeded" error. (Dmitry) + . Fixed bug #53432 (Assignment via string index access on an empty string + converts to array). (Nikita) . Fixed bug #62210 (Exceptions can leak temporary variables). (Dmitry, Bob) . Fixed bug #62814 (It is possible to stiffen child class members visibility). (Nikita) diff --git a/Zend/tests/bug53432.phpt b/Zend/tests/bug53432.phpt new file mode 100644 index 0000000000..f3e9159ab0 --- /dev/null +++ b/Zend/tests/bug53432.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #53432: Assignment via string index access on an empty string converts to array +--FILE-- +getMessage()}\n"; +} +var_dump($str); + +?> +--EXPECTF-- +string(1) "a" +string(1) "a" +string(1) "a" +string(6) " a" + +Warning: Illegal string offset: -1 in %s on line %d +NULL +string(0) "" + +Warning: Illegal string offset 'foo' in %s on line %d +string(1) "a" +string(1) "a" +Error: [] operator not supported for strings +string(0) "" diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt index 0e466ab8ce..f247a420b5 100644 --- a/Zend/tests/indexing_001.phpt +++ b/Zend/tests/indexing_001.phpt @@ -12,7 +12,7 @@ foreach ($testvalues as $testvalue) { } echo "\n*** Indexing - Testing reference assignment with key ***\n"; -$testvalues=array(null, 0, 1, true, false,'',0.1,array()); +$testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { $testvalue['foo']=&$array; @@ -20,7 +20,7 @@ foreach ($testvalues as $testvalue) { } echo "*** Indexing - Testing value assignment no key ***\n"; $array=array(1); -$testvalues=array(null, 0, 1, true, false,'',0.1,array()); +$testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { $testvalue[]=$array; @@ -28,7 +28,7 @@ foreach ($testvalues as $testvalue) { } echo "\n*** Indexing - Testing reference assignment no key ***\n"; -$testvalues=array(null, 0, 1, true, false,'',0.1,array()); +$testvalues=array(null, 0, 1, true, false,0.1,array()); foreach ($testvalues as $testvalue) { $testvalue[]=&$array; @@ -63,13 +63,11 @@ array(1) { int(1) } } -array(1) { - ["foo"]=> - array(1) { - [0]=> - int(1) - } -} + +Warning: Illegal string offset 'foo' in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(1) "A" Warning: Illegal string offset 'foo' in %s on line %d @@ -110,13 +108,6 @@ array(1) { int(1) } } -array(1) { - ["foo"]=> - &array(1) { - [0]=> - int(1) - } -} Warning: Cannot use a scalar value as an array in %s on line %d float(0.1) @@ -151,13 +142,6 @@ array(1) { int(1) } } -array(1) { - [0]=> - array(1) { - [0]=> - int(1) - } -} Warning: Cannot use a scalar value as an array in %s on line %d float(0.1) @@ -193,13 +177,6 @@ array(1) { int(1) } } -array(1) { - [0]=> - &array(1) { - [0]=> - int(1) - } -} Warning: Cannot use a scalar value as an array in %s on line %d float(0.1) @@ -211,4 +188,4 @@ array(1) { } } -Done \ No newline at end of file +Done diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 44fb7292b8..38015759ed 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2380,27 +2380,21 @@ ZEND_VM_C_LABEL(try_assign_dim_array): FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (OP2_TYPE == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - FREE_UNFETCHED_OP_DATA(); - FREE_OP1_VAR_PTR(); - HANDLE_EXCEPTION(); - } else { - dim = GET_OP2_ZVAL_PTR(BP_VAR_R); - value = GET_OP_DATA_ZVAL_PTR_DEREF(BP_VAR_R); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - FREE_OP_DATA(); - } + if (OP2_TYPE == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + FREE_UNFETCHED_OP_DATA(); + FREE_OP1_VAR_PTR(); + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -ZEND_VM_C_LABEL(assign_dim_convert_to_array): - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - ZEND_VM_C_GOTO(try_assign_dim_array); + dim = GET_OP2_ZVAL_PTR(BP_VAR_R); + value = GET_OP_DATA_ZVAL_PTR_DEREF(BP_VAR_R); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - ZEND_VM_C_GOTO(assign_dim_convert_to_array); + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + ZEND_VM_C_GOTO(try_assign_dim_array); } else { if (OP1_TYPE != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 67def7658e..03c64fa1a7 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -19068,27 +19068,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -19174,27 +19168,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -19280,27 +19268,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -19386,27 +19368,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -21107,27 +21083,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -21213,27 +21183,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -21319,27 +21283,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -21425,27 +21383,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -24082,27 +24034,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -24188,27 +24134,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -24294,27 +24234,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -24400,27 +24334,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -27200,27 +27128,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -27306,27 +27228,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -27412,27 +27328,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -27518,27 +27428,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - - if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - } + if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_VAR != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -41491,27 +41395,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -41597,27 +41495,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -41703,27 +41595,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -41809,27 +41695,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CONST == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if (IS_CONST == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = EX_CONSTANT(opline->op2); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = EX_CONSTANT(opline->op2); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -44711,27 +44591,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -44817,27 +44691,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -44923,27 +44791,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -45029,27 +44891,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_UNUSED == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if (IS_UNUSED == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = NULL; - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = NULL; + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -48552,27 +48408,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -48658,27 +48508,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -48764,27 +48608,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -48870,27 +48708,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if (IS_CV == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - + if (IS_CV == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -52744,27 +52576,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = EX_CONSTANT((opline+1)->op1); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = EX_CONSTANT((opline+1)->op1); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -52850,27 +52676,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -52956,27 +52776,21 @@ try_assign_dim_array: zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); - zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); + zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - zval_ptr_dtor_nogc(free_op_data); - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_var_deref((opline+1)->op1.var, execute_data, &free_op_data); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + zval_ptr_dtor_nogc(free_op_data); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array"); @@ -53062,27 +52876,21 @@ try_assign_dim_array: } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { - if (EXPECTED(Z_STRLEN_P(object_ptr) != 0)) { - if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { - zend_throw_error(NULL, "[] operator not supported for strings"); + if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) { + zend_throw_error(NULL, "[] operator not supported for strings"); - HANDLE_EXCEPTION(); - } else { - dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); - value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); - zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); - - } + HANDLE_EXCEPTION(); } else { - zval_ptr_dtor_nogc(object_ptr); -assign_dim_convert_to_array: - ZVAL_NEW_ARR(object_ptr); - zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); - goto try_assign_dim_array; + dim = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2); + value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, (opline+1)->op1.var); + zend_assign_to_string_offset(object_ptr, dim, value, (UNEXPECTED(RETURN_VALUE_USED(opline)) ? EX_VAR(opline->result.var) : NULL)); + } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - goto assign_dim_convert_to_array; + ZVAL_NEW_ARR(object_ptr); + zend_hash_init(Z_ARRVAL_P(object_ptr), 8, NULL, ZVAL_PTR_DTOR, 0); + goto try_assign_dim_array; } else { if (IS_CV != IS_VAR || UNEXPECTED(!Z_ISERROR_P(object_ptr))) { zend_error(E_WARNING, "Cannot use a scalar value as an array");