From d0cb145cf4e41b50ae5ae6be0ffa8198dcab2e56 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Wed, 9 Jun 2021 21:50:54 +0100 Subject: [PATCH 01/14] Tyson's prototype Co-authored-by: Tyson Andre --- Zend/tests/falsetoarray.phpt | 91 ++++++++++++++++ Zend/zend_execute.c | 12 +++ Zend/zend_vm_def.h | 10 ++ Zend/zend_vm_execute.h | 200 +++++++++++++++++++++++++++++++++++ 4 files changed, 313 insertions(+) create mode 100644 Zend/tests/falsetoarray.phpt diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt new file mode 100644 index 0000000000000..cd3d74babcb3a --- /dev/null +++ b/Zend/tests/falsetoarray.phpt @@ -0,0 +1,91 @@ +--TEST-- +Autovivification of false to array +--FILE-- +def = false; + $this->def[] = 42; + // yes + $this->untyped[] = 42; + // yes + self::$st[] = 42; + // yes + static::$st2[] = 42; + // yes + $this::$st3[] = 42; + // yes + $this->pu[] = 42; + // yes + $this->pr[] = 42; + } +} +new Cfalse(false, false); + +?> +--EXPECTF-- +Deprecated: Automatic conversion of false to array is deprecated in %s + +Deprecated: Automatic conversion of false to array is deprecated in %s +now function + +Deprecated: Automatic conversion of false to array is deprecated in %s + +Deprecated: Automatic conversion of false to array is deprecated in %s + +Deprecated: Automatic conversion of false to array is deprecated in %s + +Deprecated: Automatic conversion of false to array is deprecated in %s +now class + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 43 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 45 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 47 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 49 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 51 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 53 + +Deprecated: Automatic conversion of false to array is deprecated in %s on line 55 diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 8477927b9eeeb..514625596364b 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2276,6 +2276,9 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * return; } } + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } array_init(container); goto fetch_from_array; } else { @@ -2331,6 +2334,9 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * ZVAL_UNDEFINED_OP1(); } if (type != BP_VAR_UNSET) { + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } array_init(container); goto fetch_from_array; } else { @@ -2861,6 +2867,12 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c ZVAL_INDIRECT(result, ptr); if (flags) { + if (flags == ZEND_FETCH_DIM_WRITE) { + if (Z_TYPE_P(ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + } + zend_property_info *prop_info; if (prop_op_type == IS_CONST) { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 4a2e9a03531a3..d8c872da16b23 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1210,6 +1210,11 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array): if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); ZEND_VM_C_GOTO(assign_dim_op_new_array); } else { @@ -2590,6 +2595,11 @@ ZEND_VM_C_LABEL(try_assign_dim_array): FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 4b7839af13293..96cf886615104 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -22411,6 +22411,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_H if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -23356,6 +23361,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -23469,6 +23479,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -23582,6 +23597,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -23694,6 +23714,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -24943,6 +24968,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_ if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -25893,6 +25923,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -26006,6 +26041,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -26119,6 +26159,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -26231,6 +26276,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -27113,6 +27163,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_ if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -27262,6 +27317,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -27375,6 +27435,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -27488,6 +27553,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -27600,6 +27670,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -28833,6 +28908,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HAND if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -29778,6 +29858,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -29891,6 +29976,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -30004,6 +30094,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -30116,6 +30211,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -39413,6 +39513,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HA if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -40621,6 +40726,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -40734,6 +40844,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -40847,6 +40962,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -40959,6 +41079,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -43021,6 +43146,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -44228,6 +44358,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -44341,6 +44476,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -44454,6 +44594,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -44566,6 +44711,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -45767,6 +45917,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_H if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -46042,6 +46197,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -46155,6 +46315,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -46268,6 +46433,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -46380,6 +46550,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -48013,6 +48188,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDL if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -49216,6 +49396,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -49329,6 +49514,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -49442,6 +49632,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { @@ -49554,6 +49749,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { + + if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } + if (Z_ISREF_P(orig_object_ptr) && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr)) && !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) { From 2453adcdcdd3e04d9127467ae2f4a2b87b35763b Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 11 Jun 2021 13:58:04 +0100 Subject: [PATCH 02/14] fix test case --- Zend/tests/falsetoarray.phpt | 90 +++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt index cd3d74babcb3a..800f4bc8f10c3 100644 --- a/Zend/tests/falsetoarray.phpt +++ b/Zend/tests/falsetoarray.phpt @@ -3,37 +3,41 @@ Autovivification of false to array --FILE-- def = false; $this->def[] = 42; - // yes + print "[008]\n"; $this->untyped[] = 42; - // yes + print "[009]\n"; self::$st[] = 42; - // yes + print "[010]\n"; static::$st2[] = 42; - // yes + print "[011]\n"; $this::$st3[] = 42; - // yes + print "[012]\n"; $this->pu[] = 42; - // yes + print "[013]\n"; $this->pr[] = 42; } } new Cfalse(false, false); +echo "\nDestructuring\n"; + +print "[014]\n"; +$add = false; +foreach ([42] as $add[]); + +print "[015]\n"; +$arr = false; +[$arr[]] = [42]; + ?> --EXPECTF-- +[001] + Deprecated: Automatic conversion of false to array is deprecated in %s +[002] Deprecated: Automatic conversion of false to array is deprecated in %s -now function + +Function +[003] Deprecated: Automatic conversion of false to array is deprecated in %s +[004] Deprecated: Automatic conversion of false to array is deprecated in %s +[005] Deprecated: Automatic conversion of false to array is deprecated in %s +[006] Deprecated: Automatic conversion of false to array is deprecated in %s -now class -Deprecated: Automatic conversion of false to array is deprecated in %s on line 43 +Properties +[007] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 45 +Deprecated: Automatic conversion of false to array is deprecated in %s +[008] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 47 +Deprecated: Automatic conversion of false to array is deprecated in %s +[009] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 49 +Deprecated: Automatic conversion of false to array is deprecated in %s +[010] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 51 +Deprecated: Automatic conversion of false to array is deprecated in %s +[011] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[012] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[013] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 53 +Deprecated: Automatic conversion of false to array is deprecated in %s + +Destructuring +[014] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[015] -Deprecated: Automatic conversion of false to array is deprecated in %s on line 55 +Deprecated: Automatic conversion of false to array is deprecated in %s \ No newline at end of file From 3badc5c006c91d62b236f85468a6e9a6ee903715 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 11 Jun 2021 14:33:46 +0100 Subject: [PATCH 03/14] This one is redundant --- Zend/zend_execute.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 514625596364b..5608c87d7d1e3 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2867,12 +2867,6 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c ZVAL_INDIRECT(result, ptr); if (flags) { - if (flags == ZEND_FETCH_DIM_WRITE) { - if (Z_TYPE_P(ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); - } - } - zend_property_info *prop_info; if (prop_op_type == IS_CONST) { From 538ede32a1a66f22f0632d8dd2661ee1fc3f09fa Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 11 Jun 2021 14:54:09 +0100 Subject: [PATCH 04/14] Add deprecation notices to test case --- Zend/tests/indexing_001.phpt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt index 00f98237b595d..66b20da03a03e 100644 --- a/Zend/tests/indexing_001.phpt +++ b/Zend/tests/indexing_001.phpt @@ -52,7 +52,7 @@ foreach ($testvalues as $testvalue) { } ?> ---EXPECT-- +--EXPECTF-- *** Indexing - Testing value assignment with key *** array(1) { ["foo"]=> @@ -67,6 +67,8 @@ Cannot use a scalar value as an array int(1) Cannot use a scalar value as an array bool(true) + +Deprecated: Automatic conversion of false to array is deprecated in %s array(1) { ["foo"]=> array(1) { @@ -102,6 +104,8 @@ Cannot use a scalar value as an array int(1) Cannot use a scalar value as an array bool(true) + +Deprecated: Automatic conversion of false to array is deprecated in %s array(1) { ["foo"]=> &array(1) { @@ -132,6 +136,8 @@ Cannot use a scalar value as an array int(1) Cannot use a scalar value as an array bool(true) + +Deprecated: Automatic conversion of false to array is deprecated in %s array(1) { [0]=> array(1) { @@ -163,6 +169,8 @@ Cannot use a scalar value as an array int(1) Cannot use a scalar value as an array bool(true) + +Deprecated: Automatic conversion of false to array is deprecated in %s array(1) { [0]=> &array(1) { From 710976ef1ed54b656cf9ed7683654e3347d9a933 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 11 Jun 2021 15:44:40 +0100 Subject: [PATCH 05/14] Unneeded? --- Zend/tests/falsetoarray.phpt | 15 +++++++++++ Zend/zend_execute.c | 3 --- Zend/zend_vm_def.h | 3 --- Zend/zend_vm_execute.h | 48 ------------------------------------ 4 files changed, 15 insertions(+), 54 deletions(-) diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt index 800f4bc8f10c3..e96bd8043c46d 100644 --- a/Zend/tests/falsetoarray.phpt +++ b/Zend/tests/falsetoarray.phpt @@ -74,6 +74,15 @@ print "[015]\n"; $arr = false; [$arr[]] = [42]; +print "[016]\n"; +$arr = [ 0 => [ 0 => false ] ]; +$arr[0][0][0][] = 42; + +print "[017]\n"; +$false = false; +$r42 = 42; +$false[] &= $r42; + ?> --EXPECTF-- [001] @@ -126,4 +135,10 @@ Destructuring Deprecated: Automatic conversion of false to array is deprecated in %s [015] +Deprecated: Automatic conversion of false to array is deprecated in %s +[016] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[017] + Deprecated: Automatic conversion of false to array is deprecated in %s \ No newline at end of file diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 5608c87d7d1e3..15094cd49a4f7 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2276,9 +2276,6 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * return; } } - if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); - } array_init(container); goto fetch_from_array; } else { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index d8c872da16b23..a5f5d6d85ff2a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1210,11 +1210,9 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array): if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); ZEND_VM_C_GOTO(assign_dim_op_new_array); } else { @@ -2595,7 +2593,6 @@ ZEND_VM_C_LABEL(try_assign_dim_array): FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 96cf886615104..d70405d71e129 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -22411,11 +22411,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_H if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -23361,7 +23359,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -23479,7 +23476,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -23597,7 +23593,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -23714,7 +23709,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -24968,11 +24962,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_ if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -25923,7 +25915,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -26041,7 +26032,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -26159,7 +26149,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -26276,7 +26265,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -27163,11 +27151,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_ if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -27317,7 +27303,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -27435,7 +27420,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -27553,7 +27537,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -27670,7 +27653,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -28908,11 +28890,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HAND if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -29858,7 +29838,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -29976,7 +29955,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -30094,7 +30072,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -30211,7 +30188,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -39513,11 +39489,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HA if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -40726,7 +40700,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -40844,7 +40817,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -40962,7 +40934,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -41079,7 +41050,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -43146,11 +43116,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -44358,7 +44326,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -44476,7 +44443,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -44594,7 +44560,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -44711,7 +44676,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -45917,11 +45881,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_H if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -46197,7 +46159,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -46315,7 +46276,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -46433,7 +46393,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -46550,7 +46509,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -48188,11 +48146,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDL if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } - if (Z_TYPE_P(container) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } - ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; } else { @@ -49396,7 +49352,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -49514,7 +49469,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -49632,7 +49586,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var)); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } @@ -49749,7 +49702,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { - if (Z_TYPE_P(object_ptr) == IS_FALSE) { zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } From 274eb7090c2609a2f94fe74f28c954006837bbfc Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 11 Jun 2021 15:58:47 +0100 Subject: [PATCH 06/14] Add more tests --- Zend/tests/falsetoarray.phpt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt index e96bd8043c46d..e06193c8aa0e8 100644 --- a/Zend/tests/falsetoarray.phpt +++ b/Zend/tests/falsetoarray.phpt @@ -83,6 +83,30 @@ $false = false; $r42 = 42; $false[] &= $r42; +$false = false; +$false2 = false; +$false3 = false; +function &g(){ + print "[018]\n"; + global $false; + $false[] = 42; + + $var1 = false; + $GLOBALS["false2"] =& $var1; + + print "[019]\n"; + $GLOBALS["false3"][] = 42; + + print "[020]\n"; + static $f2 = false; + return $f2; +} + +$false = &g(); +$false[] = 42; +print "[021]\n"; +$false2[] = 42; + ?> --EXPECTF-- [001] @@ -141,4 +165,16 @@ Deprecated: Automatic conversion of false to array is deprecated in %s Deprecated: Automatic conversion of false to array is deprecated in %s [017] +Deprecated: Automatic conversion of false to array is deprecated in %s +[018] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[019] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[020] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[021] + Deprecated: Automatic conversion of false to array is deprecated in %s \ No newline at end of file From 71eb2f190b23563fb5a9e39a57cdf3d679f223a2 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 15 Jun 2021 12:48:00 +0100 Subject: [PATCH 07/14] Update JIT test case --- ext/opcache/tests/jit/assign_dim_002.phpt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt index feb80b7c4003b..3bb9b32c3beff 100644 --- a/ext/opcache/tests/jit/assign_dim_002.phpt +++ b/ext/opcache/tests/jit/assign_dim_002.phpt @@ -81,6 +81,17 @@ function foo5() { } var_dump(foo5()); +function foo6() { + $a = false; + try { + $a[2] = 1; + } catch (Error $e) { + echo $e->getMessage(), "\n"; + } + return $a; +} +var_dump(foo6()); + ?> --EXPECTF-- array(1) { @@ -136,3 +147,9 @@ array(1) { } Cannot use a scalar value as an array int(1) + +Deprecated: Automatic conversion of false to array is deprecated in %s +array(1) { + [2]=> + int(1) +} \ No newline at end of file From 613d737052386693ee95dbba3bffe116fedd2496 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 15 Jun 2021 13:19:29 +0100 Subject: [PATCH 08/14] Added Nikita's suggestion --- Zend/tests/falsetoarray.phpt | 16 +++++++++++++++- Zend/zend_execute.c | 6 +++--- Zend/zend_vm_def.h | 2 ++ Zend/zend_vm_execute.h | 12 ++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt index e06193c8aa0e8..473da5f3c4aeb 100644 --- a/Zend/tests/falsetoarray.phpt +++ b/Zend/tests/falsetoarray.phpt @@ -107,6 +107,14 @@ $false[] = 42; print "[021]\n"; $false2[] = 42; +print "[022]\n"; +$a = false; +unset($a[0][0]); + +print "[023]\n"; +$a = false; +unset($a[0]); + ?> --EXPECTF-- [001] @@ -177,4 +185,10 @@ Deprecated: Automatic conversion of false to array is deprecated in %s Deprecated: Automatic conversion of false to array is deprecated in %s [021] -Deprecated: Automatic conversion of false to array is deprecated in %s \ No newline at end of file +Deprecated: Automatic conversion of false to array is deprecated in %s +[022] + +Deprecated: Automatic conversion of false to array is deprecated in %s +[023] + +Deprecated: Unsetting offset in a false variable is deprecated in %s diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 15094cd49a4f7..0ae7b38dda4a0 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2330,10 +2330,10 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * if (type != BP_VAR_W && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); } + if (Z_TYPE_P(container) == IS_FALSE) { + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + } if (type != BP_VAR_UNSET) { - if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); - } array_init(container); goto fetch_from_array; } else { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index a5f5d6d85ff2a..e097989d7b4bf 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6460,6 +6460,8 @@ ZEND_VM_C_LABEL(num_index_dim): zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d70405d71e129..7f0e93cf1edcd 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -24550,6 +24550,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDL zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); @@ -26703,6 +26705,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HAND zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); @@ -30699,6 +30703,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER( zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); @@ -41809,6 +41815,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLE zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); @@ -45254,6 +45262,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); @@ -50353,6 +50363,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(Z zend_throw_error(NULL, "Cannot unset string offsets"); } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { + zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); } } while (0); From 1590246e2a0a5270ba1965dcb4406178e8f1b23c Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 15 Jun 2021 15:19:28 +0100 Subject: [PATCH 09/14] Update Nikita's test --- Zend/tests/unset_non_array.phpt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zend/tests/unset_non_array.phpt b/Zend/tests/unset_non_array.phpt index e58e9e3b0b1a8..1541c04eb630b 100644 --- a/Zend/tests/unset_non_array.phpt +++ b/Zend/tests/unset_non_array.phpt @@ -95,6 +95,8 @@ try { ?> --EXPECTF-- Warning: Undefined variable $x in %s on line %d + +Deprecated: Unsetting offset in a false variable is deprecated in %s Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable @@ -102,6 +104,8 @@ Cannot unset string offsets Cannot use object of type stdClass as array Warning: Undefined variable $x in %s on line %d + +Deprecated: Automatic conversion of false to array is deprecated in %s Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable From 6cebe70eab615632a6c9ae148c806657094494d5 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 15 Jun 2021 17:38:17 +0100 Subject: [PATCH 10/14] Unify error messages --- Zend/tests/falsetoarray.phpt | 2 +- Zend/tests/unset_non_array.phpt | 2 +- Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Zend/tests/falsetoarray.phpt b/Zend/tests/falsetoarray.phpt index 473da5f3c4aeb..a7e6f1ffe465e 100644 --- a/Zend/tests/falsetoarray.phpt +++ b/Zend/tests/falsetoarray.phpt @@ -191,4 +191,4 @@ Deprecated: Automatic conversion of false to array is deprecated in %s Deprecated: Automatic conversion of false to array is deprecated in %s [023] -Deprecated: Unsetting offset in a false variable is deprecated in %s +Deprecated: Automatic conversion of false to array is deprecated in %s diff --git a/Zend/tests/unset_non_array.phpt b/Zend/tests/unset_non_array.phpt index 1541c04eb630b..cef7f9a765805 100644 --- a/Zend/tests/unset_non_array.phpt +++ b/Zend/tests/unset_non_array.phpt @@ -96,7 +96,7 @@ try { --EXPECTF-- Warning: Undefined variable $x in %s on line %d -Deprecated: Unsetting offset in a false variable is deprecated in %s +Deprecated: Automatic conversion of false to array is deprecated in %s Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable Cannot unset offset in a non-array variable diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e097989d7b4bf..71be8ca56ec05 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -6461,7 +6461,7 @@ ZEND_VM_C_LABEL(num_index_dim): } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 7f0e93cf1edcd..ada3af6db4f15 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -24551,7 +24551,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDL } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); @@ -26706,7 +26706,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HAND } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); @@ -30704,7 +30704,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER( } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); @@ -41816,7 +41816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLE } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); @@ -45263,7 +45263,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); @@ -50364,7 +50364,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(Z } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Unsetting offset in a false variable is deprecated"); + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); } } while (0); From ca0d0348d3272631687e8e28e95fce4da5e245d9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Jul 2021 16:33:05 +0200 Subject: [PATCH 11/14] Handle autovivification warning in may_throw --- Zend/Optimizer/zend_inference.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 18950feaf9173..0d2a8ef322278 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -4753,7 +4753,7 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, return 1; } } - return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED || + return (t1 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_TRUE|MAY_BE_FALSE|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE)) || opline->op2_type == IS_UNUSED || (t2 & (MAY_BE_UNDEF|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); case ZEND_ASSIGN_OBJ: if (t1 & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_OBJECT))) { @@ -4869,7 +4869,7 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, return 0; case ZEND_FETCH_DIM_W: case ZEND_FETCH_LIST_W: - if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) { + if (t1 & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) { return 1; } if (t2 & (MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT)) { From bcd43d4c2a422dda0a84ec5020f7e5f8e960150d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 7 Jul 2021 15:05:20 +0200 Subject: [PATCH 12/14] Add JIT support Move handling of false to the slow path. --- Zend/zend_execute.c | 7 +- Zend/zend_execute.h | 1 + Zend/zend_vm_def.h | 6 +- Zend/zend_vm_execute.h | 92 ++++++++++---------- ext/opcache/jit/zend_jit_arm64.dasc | 60 ++++++------- ext/opcache/jit/zend_jit_helpers.c | 79 ++++++++++++----- ext/opcache/jit/zend_jit_x86.dasc | 60 ++++++------- ext/opcache/tests/jit/assign_dim_002.phpt | 80 +++++++++++++++-- ext/opcache/tests/jit/assign_dim_op_001.phpt | 88 +++++++++++++++++-- 9 files changed, 327 insertions(+), 146 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 0ae7b38dda4a0..8c86b2e8c1f23 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1583,6 +1583,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_functi } } +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_false_to_array_deprecated(void) +{ + zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); +} + static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC) { zend_uchar c; @@ -2331,7 +2336,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (type != BP_VAR_UNSET) { array_init(container); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index a519b3ec91601..bd5e58531ca0e 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -58,6 +58,7 @@ extern ZEND_API const zend_internal_function zend_pass_function; ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_false_to_array_deprecated(void); ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num); ZEND_API bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference *ref, zval *zv, bool strict); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 71be8ca56ec05..1ed423bb374f5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1211,7 +1211,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array): ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); ZEND_VM_C_GOTO(assign_dim_op_new_array); @@ -2594,7 +2594,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array): } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -6461,7 +6461,7 @@ ZEND_VM_C_LABEL(num_index_dim): } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index ada3af6db4f15..1af7e517d04e5 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -22412,7 +22412,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_H ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -23360,7 +23360,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -23477,7 +23477,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -23594,7 +23594,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -23710,7 +23710,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -24551,7 +24551,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDL } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); @@ -24965,7 +24965,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_ ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -25918,7 +25918,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -26035,7 +26035,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -26152,7 +26152,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -26268,7 +26268,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -26706,7 +26706,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HAND } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); @@ -27156,7 +27156,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_ ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -27308,7 +27308,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -27425,7 +27425,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -27542,7 +27542,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -27658,7 +27658,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -28895,7 +28895,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HAND ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -29843,7 +29843,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -29960,7 +29960,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -30077,7 +30077,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -30193,7 +30193,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -30704,7 +30704,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER( } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); @@ -39496,7 +39496,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HA ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -40707,7 +40707,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -40824,7 +40824,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -40941,7 +40941,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -41057,7 +41057,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -41816,7 +41816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLE } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); @@ -43125,7 +43125,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -44335,7 +44335,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -44452,7 +44452,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -44569,7 +44569,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -44685,7 +44685,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -45263,7 +45263,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); @@ -45892,7 +45892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_H ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -46170,7 +46170,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -46287,7 +46287,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -46404,7 +46404,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -46520,7 +46520,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -48157,7 +48157,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDL ZVAL_UNDEFINED_OP1(); } if (Z_TYPE_P(container) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } ZVAL_ARR(container, zend_new_array(8)); goto assign_dim_op_new_array; @@ -49363,7 +49363,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -49480,7 +49480,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -49597,7 +49597,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -49713,7 +49713,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { if (Z_TYPE_P(object_ptr) == IS_FALSE) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } if (Z_ISREF_P(orig_object_ptr) @@ -50364,7 +50364,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(Z } else if (UNEXPECTED(Z_TYPE_P(container) > IS_FALSE)) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); } else if (UNEXPECTED(Z_TYPE_P(container) == IS_FALSE)) { - zend_error(E_DEPRECATED, "Automatic conversion of false to array is deprecated"); + zend_false_to_array_deprecated(); } } while (0); diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 9e80979786a80..94595b66f7057 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -5743,9 +5743,9 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t } |3: | SEPARATE_ARRAY op1_addr, op1_info, 1, ZREG_TMP1, ZREG_TMP2 - } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE, ZREG_TMP1 + } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL, ZREG_TMP1 | bgt >7 } | // ZVAL_ARR(container, zend_new_array(8)); @@ -5762,7 +5762,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t | mov FCARG1x, REG0 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |6: if (opline->op2_type == IS_UNUSED) { uint32_t var_info = MAY_BE_NULL; @@ -5816,17 +5816,17 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t } if (((op1_info & MAY_BE_ARRAY) && - (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE))) || - (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)))) { - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL))) || + (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY)))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } - if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) && + if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) && (op1_info & MAY_BE_ARRAY)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE, ZREG_TMP1 + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL, ZREG_TMP1 | bgt >2 } | // ZVAL_ARR(container, zend_new_array(8)); @@ -5846,7 +5846,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t |2: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { | SET_EX_OPLINE opline, REG0 if (Z_REG(op1_addr) != ZREG_FCARG1x || Z_OFFSET(op1_addr) != 0) { | LOAD_ZVAL_ADDR FCARG1x, op1_addr @@ -5877,8 +5877,8 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t | FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline, ZREG_TMP1, ZREG_TMP2 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { | b >9 // END } |.code @@ -5939,17 +5939,17 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 |3: | SEPARATE_ARRAY op1_addr, op1_info, 1, ZREG_TMP1, ZREG_TMP2 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { if (op1_info & MAY_BE_ARRAY) { |.cold_code |7: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE, ZREG_TMP1 + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL, ZREG_TMP1 | bgt >7 } if (op1_info & MAY_BE_UNDEF) { - if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & MAY_BE_NULL) { | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1, ZREG_TMP1 } | SET_EX_OPLINE opline, REG0 @@ -5976,7 +5976,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 } } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { uint32_t var_info; uint32_t var_def_info = zend_array_element_type(op1_def_info, opline->op1_type, 1, 0); @@ -6067,10 +6067,10 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 | FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline, ZREG_TMP1, ZREG_TMP2 } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { binary_op_type binary_op; - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } @@ -6099,12 +6099,12 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 zend_jit_check_exception(Dst); } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { | b >9 // END |.code |9: } - } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |9: | FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline, ZREG_TMP1, ZREG_TMP2 @@ -11107,13 +11107,13 @@ static int zend_jit_fetch_dim(dasm_State **Dst, |3: | SEPARATE_ARRAY op1_addr, op1_info, 1, ZREG_TMP1, ZREG_TMP2 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { if (op1_info & MAY_BE_ARRAY) { |.cold_code |7: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE, ZREG_TMP1 + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL, ZREG_TMP1 | bgt >7 } if (Z_REG(op1_addr) != ZREG_FP) { @@ -11121,7 +11121,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } if ((op1_info & MAY_BE_UNDEF) && opline->opcode == ZEND_FETCH_DIM_RW) { - if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & MAY_BE_NULL) { | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1, ZREG_TMP1 } | SET_EX_OPLINE opline, REG0 @@ -11145,7 +11145,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |6: if (opline->op2_type == IS_UNUSED) { | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval)); @@ -11199,8 +11199,8 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } @@ -11233,7 +11233,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, ZEND_UNREACHABLE(); } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { | b >8 // END |.code } diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 3919259c38f37..0a22bfa2cc6a9 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1073,6 +1073,26 @@ static zend_always_inline void ZEND_FASTCALL zend_jit_fetch_dim_obj_helper(zval } } ZVAL_UNDEF(result); + } else if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_false_to_array_deprecated(); + zend_array *arr = zend_new_array(0); + ZVAL_ARR(object_ptr, arr); + zval *var; + if (dim) { + if (type == BP_VAR_W) { + var = zend_jit_fetch_dim_w_helper(arr, dim); + } else { + ZEND_ASSERT(type == BP_VAR_RW); + var = zend_jit_fetch_dim_rw_helper(arr, dim); + } + } else { + var = zend_hash_next_index_insert_new(arr, &EG(uninitialized_zval)); + } + if (var) { + ZVAL_INDIRECT(result, var); + } else { + ZVAL_UNDEF(result); + } } else { if (type == BP_VAR_UNSET) { zend_throw_error(NULL, "Cannot unset offset in a non-array variable"); @@ -1120,6 +1140,24 @@ static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim } else { zend_assign_to_string_offset(object_ptr, dim, value, result); } + } else if (Z_TYPE_P(object_ptr) == IS_FALSE) { + zend_false_to_array_deprecated(); + zend_array *arr = zend_new_array(0); + ZVAL_ARR(object_ptr, arr); + zval *var = dim + ? zend_jit_fetch_dim_w_helper(arr, dim) + : zend_hash_next_index_insert_new(arr, &EG(uninitialized_zval)); + if (!var) { + if (result) { + ZVAL_UNDEF(result); + } + return; + } + + ZVAL_COPY_DEREF(var, value); + if (result) { + ZVAL_COPY(result, var); + } } else { zend_throw_error(NULL, "Cannot use a scalar value as an array"); if (result) { @@ -1145,34 +1183,31 @@ static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *d if (z == &rv) { zval_ptr_dtor(&rv); } -//??? if (retval) { -//??? ZVAL_COPY(retval, &res); -//??? } zval_ptr_dtor(&res); } else { zend_error(E_WARNING, "Attempt to assign property of non-object"); -//??? if (retval) { -//??? ZVAL_NULL(retval); -//??? } } - } else { - if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) { - if (!dim) { - zend_throw_error(NULL, "[] operator not supported for strings"); - } else { - if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { - zend_check_string_offset(dim/*, BP_VAR_RW*/); - } - zend_wrong_string_offset(); - } -//??? } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { -//??? ZEND_VM_C_GOTO(assign_dim_op_convert_to_array); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) { + if (!dim) { + zend_throw_error(NULL, "[] operator not supported for strings"); } else { - zend_throw_error(NULL, "Cannot use a scalar value as an array"); -//??? if (retval) { -//??? ZVAL_NULL(retval); -//??? } + if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) { + zend_check_string_offset(dim/*, BP_VAR_RW*/); + } + zend_wrong_string_offset(); + } + } else if (Z_TYPE_P(container) == IS_FALSE) { + zend_false_to_array_deprecated(); + zend_array *arr = zend_new_array(0); + ZVAL_ARR(container, arr); + zval *var = dim + ? zend_jit_fetch_dim_rw_helper(arr, dim) + : zend_hash_next_index_insert_new(arr, &EG(uninitialized_zval)); + if (var) { + binary_op(var, var, value); } + } else { + zend_throw_error(NULL, "Cannot use a scalar value as an array"); } } diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 771126f644215..924fe241efdff 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -6224,9 +6224,9 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t } |3: | SEPARATE_ARRAY op1_addr, op1_info, 1 - } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE + } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL | jg >7 } | // ZVAL_ARR(container, zend_new_array(8)); @@ -6242,7 +6242,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t | mov FCARG1a, r0 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |6: if (opline->op2_type == IS_UNUSED) { uint32_t var_info = MAY_BE_NULL; @@ -6296,17 +6296,17 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t } if (((op1_info & MAY_BE_ARRAY) && - (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE))) || - (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)))) { - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL))) || + (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY)))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } - if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) && + if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) && (op1_info & MAY_BE_ARRAY)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL | jg >2 } | // ZVAL_ARR(container, zend_new_array(8)); @@ -6325,7 +6325,7 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t |2: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { | SET_EX_OPLINE opline, r0 if (Z_REG(op1_addr) != ZREG_FCARG1a || Z_OFFSET(op1_addr) != 0) { | LOAD_ZVAL_ADDR FCARG1a, op1_addr @@ -6374,8 +6374,8 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, uint32_t | FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, opline } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { | jmp >9 // END } |.code @@ -6435,17 +6435,17 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 |3: | SEPARATE_ARRAY op1_addr, op1_info, 1 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { if (op1_info & MAY_BE_ARRAY) { |.cold_code |7: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL | jg >7 } if (op1_info & MAY_BE_UNDEF) { - if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & MAY_BE_NULL) { | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1 } | SET_EX_OPLINE opline, r0 @@ -6471,7 +6471,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 } } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { uint32_t var_info; uint32_t var_def_info = zend_array_element_type(op1_def_info, opline->op1_type, 1, 0); @@ -6570,10 +6570,10 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 | FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { binary_op_type binary_op; - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } @@ -6611,12 +6611,12 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3 zend_jit_check_exception(Dst); } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { | jmp >9 // END |.code |9: } - } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |9: | FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline @@ -11761,13 +11761,13 @@ static int zend_jit_fetch_dim(dasm_State **Dst, |3: | SEPARATE_ARRAY op1_addr, op1_info, 1 } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL)) { if (op1_info & MAY_BE_ARRAY) { |.cold_code |7: } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - | CMP_ZVAL_TYPE op1_addr, IS_FALSE + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + | CMP_ZVAL_TYPE op1_addr, IS_NULL | jg >7 } if (Z_REG(op1_addr) != ZREG_FP) { @@ -11775,7 +11775,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } if ((op1_info & MAY_BE_UNDEF) && opline->opcode == ZEND_FETCH_DIM_RW) { - if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) { + if (op1_info & MAY_BE_NULL) { | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1 } | SET_EX_OPLINE opline, r0 @@ -11798,7 +11798,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } } - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |6: if (opline->op2_type == IS_UNUSED) { | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval)); @@ -11853,8 +11853,8 @@ static int zend_jit_fetch_dim(dasm_State **Dst, } } - if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) { - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_ARRAY))) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { |.cold_code |7: } @@ -11895,7 +11895,7 @@ static int zend_jit_fetch_dim(dasm_State **Dst, | add r4, 12 |.endif - if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) { + if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_ARRAY)) { | jmp >8 // END |.code } diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt index 3bb9b32c3beff..a072ec26fda13 100644 --- a/ext/opcache/tests/jit/assign_dim_002.phpt +++ b/ext/opcache/tests/jit/assign_dim_002.phpt @@ -81,16 +81,44 @@ function foo5() { } var_dump(foo5()); -function foo6() { - $a = false; - try { - $a[2] = 1; - } catch (Error $e) { - echo $e->getMessage(), "\n"; - } +function false_to_array($a) { + var_dump($a[2] = 1); + return $a; +} +function false_to_array_append($a) { + var_dump($a[] = 1); + return $a; +} +function false_to_array_invalid_index($a) { + var_dump($a[[]] = 1); + return $a; +} +function false_to_array_nested($a) { + var_dump($a[2][3] = 1); return $a; } -var_dump(foo6()); +function false_to_array_nested_append($a) { + var_dump($a[][] = 1); + return $a; +} +function false_to_array_nested_invalid_index($a) { + var_dump($a[[]][0] = 1); + return $a; +} +var_dump(false_to_array(false)); +var_dump(false_to_array_append(false)); +try { + var_dump(false_to_array_invalid_index(false)); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +var_dump(false_to_array_nested(false)); +var_dump(false_to_array_nested_append(false)); +try { + var_dump(false_to_array_nested_invalid_index(false)); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- @@ -149,7 +177,41 @@ Cannot use a scalar value as an array int(1) Deprecated: Automatic conversion of false to array is deprecated in %s +int(1) array(1) { [2]=> int(1) -} \ No newline at end of file +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +int(1) +array(1) { + [0]=> + int(1) +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +Illegal offset type + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +int(1) +array(1) { + [2]=> + array(1) { + [3]=> + int(1) + } +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +int(1) +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +Illegal offset type diff --git a/ext/opcache/tests/jit/assign_dim_op_001.phpt b/ext/opcache/tests/jit/assign_dim_op_001.phpt index 0f481ba4834cb..86fdd94181b53 100644 --- a/ext/opcache/tests/jit/assign_dim_op_001.phpt +++ b/ext/opcache/tests/jit/assign_dim_op_001.phpt @@ -9,13 +9,91 @@ opcache.jit_buffer_size=1M opcache --FILE-- getMessage(), "\n"; +} +var_dump(false_to_array_nested(false)); +var_dump(false_to_array_nested_append(false)); +try { + var_dump(false_to_array_nested_invalid_index(false)); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + ?> ---EXPECT-- +--EXPECTF-- array(1) { ["ab"]=> int(2) } + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d + +Warning: Undefined array key 2 in %s on line %d + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +Illegal offset type + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d + +Warning: Undefined array key 2 in %s on line %d + +Warning: Undefined array key 3 in %s on line %d +array(1) { + [2]=> + array(1) { + [3]=> + int(1) + } +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +Deprecated: Automatic conversion of false to array is deprecated in %s on line %d +Illegal offset type From 827a9dfaf7fab7506c82f7b1fa8b3c8e0463ceb6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 15 Jul 2021 16:46:22 +0200 Subject: [PATCH 13/14] Handle one more case in zend_jit_prepare_assign_dim_ref() --- ext/opcache/jit/zend_jit_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 0a22bfa2cc6a9..59966ca09226d 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1926,6 +1926,9 @@ static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) { && !zend_verify_ref_array_assignable(Z_REF_P(ref))) { return NULL; } + if (Z_TYPE_P(val) == IS_FALSE) { + zend_false_to_array_deprecated(); + } ZVAL_ARR(val, zend_new_array(8)); } return val; From 8c2c5d9240a10159dd295ea29675c3d0af785f8f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 16 Jul 2021 10:51:04 +0200 Subject: [PATCH 14/14] Fix may_throw and indirect_reference in tracing JIT We now may_throw for MAY_BE_FALSE. Also don't set indirect_feference in this case, as we now go through the slow path and the container isn't guaranteed to be in r0/REG0 anymore. --- ext/opcache/jit/zend_jit_trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 6ff14e79b2efc..3be1e771ae2f0 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -5198,7 +5198,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par op1_info, op1_addr, op2_info, RES_REG_ADDR(), (opline->opcode == ZEND_FETCH_DIM_RW || opline->op2_type == IS_UNUSED - || (op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) + || (op1_info & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) || (op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT)) || (opline->op1_type == IS_VAR && (op1_info & MAY_BE_UNDEF) @@ -5207,7 +5207,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par } if (ssa_op->result_def > 0 && (opline->opcode == ZEND_FETCH_DIM_W || opline->opcode == ZEND_FETCH_LIST_W) - && !(op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) + && !(op1_info & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))) { ssa->var_info[ssa_op->result_def].indirect_reference = 1; }