com php-src: Fixed bug #53432: NEWS Zend/tests/bug53432.phpt Zend/tests/indexing_001.phpt Zend/zend_vm_def .h Zend/zend_vm_execute.h
| From: | Nikita Popov | Date: | Sat, 04 Jun 2016 17:20:07 +0000 |
| Subject: | com php-src: Fixed bug #53432: NEWS Zend/tests/bug53432.phpt Zend/tests/indexing_001.phpt Zend/zend_vm_def .h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92307@lists.php.net to get a copy of this message | ||
Commit: 945a83103de8fbba66bdf643c4701263854c0056
Author: Nikita Popov <nikic@php.net> Sun, 14 Feb 2016 16:49:36 +0100
Parents: 33aba2976855888d0c8107f9b65c13694c0379a1
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=945a83103de8fbba66bdf643c4701263854c0056
Log:
Fixed bug #53432
This change was discussed a while ago in the "negative string
offsets" thread.
Bugs:
https://bugs.php.net/53432
Changed paths:
M NEWS
A Zend/tests/bug53432.phpt
M Zend/tests/indexing_001.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
diff --git a/NEWS b/NEWS index da7dda7..c3a032c 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 0000000..f3e9159 --- /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-- +<?php + +$str = ''; +var_dump($str[0] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str[5] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str[-1] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str['foo'] = 'a'); +var_dump($str); + +$str = ''; +try { + var_dump($str[] = 'a'); +} catch (Error $e) { + echo "Error: {$e->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 0e466ab..f247a42 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 44fb729..3801575 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 67def76..03c64fa 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");
diff --git a/NEWS b/NEWS index da7dda7..c3a032c 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 0000000..f3e9159 --- /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-- +<?php + +$str = ''; +var_dump($str[0] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str[5] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str[-1] = 'a'); +var_dump($str); + +$str = ''; +var_dump($str['foo'] = 'a'); +var_dump($str); + +$str = ''; +try { + var_dump($str[] = 'a'); +} catch (Error $e) { + echo "Error: {$e->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 0e466ab..f247a42 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 44fb729..3801575 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 67def76..03c64fa 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");