From a2ecea7b6920087f33e9f4befa95e67f66c8f441 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Sat, 5 Jun 2021 16:03:49 -0400 Subject: [PATCH] Autovivication prototype and investigation notes **This is not the implementation for https://wiki.php.net/rfc/autovivification_false - it is a quick and dirty prototype to quickly check on the impact autovivication would have on production applications. I am not involved in that RFC.** 1. `For $obj->dynamicProp[] = 123;`, they cannot currently be distinguished for undeclared properties because $obj->dynamicProp is converted to null when fetching the property for purposes of assignment. As a workaround, this prototype ignores null on dynamic object properties to avoid false positives. 2. Zend/optimizer would need to be updated to account for the opcodes that can now throw or have side effects such as emitting notices. This quick and dirty prototype does not implement that. 3. There may be more issues with references. 4. There may be more opcodes. 5. Exception handling and memory management was not tested --- Zend/zend_execute.c | 29 ++++ Zend/zend_object_handlers.c | 1 + Zend/zend_vm_def.h | 9 ++ Zend/zend_vm_execute.h | 288 ++++++++++++++++++++++++++++++++++++ 4 files changed, 327 insertions(+) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 1bf857151caca..08c5e7c8f2bb8 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2299,6 +2299,14 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * return; } } + if (Z_TYPE_P(container) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(container) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + ZVAL_UNDEF(result); + return; + } + } array_init(container); goto fetch_from_array; } else { @@ -2354,6 +2362,14 @@ 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_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(container) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + ZVAL_UNDEF(result); + return; + } + } array_init(container); goto fetch_from_array; } else { @@ -2863,6 +2879,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c name = zval_get_tmp_string(prop_ptr, &tmp_name); } ptr = zobj->handlers->get_property_ptr_ptr(zobj, name, type, cache_slot); + // XXX this will create the property if it does not exist and set the type to IS_NULL (only if it is a dynamic property) if (NULL == ptr) { ptr = zobj->handlers->read_property(zobj, name, type, cache_slot, result); if (ptr == result) { @@ -2882,6 +2899,18 @@ 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) { + // XXX this will emit a false positive for `$obj->unsetProp[] = 123;` because of the conversion of undefined to the null array. + if (Z_TYPE_P(ptr) >= IS_NULL && Z_TYPE_P(ptr) <= IS_FALSE) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on property field assignment is deprecated", Z_TYPE_P(ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + ZVAL_ERROR(result); + goto end; + } + } + } + zend_property_info *prop_info; if (prop_op_type == IS_CONST) { diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index fdbab21a9bec7..9c39ead6ddbf0 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -982,6 +982,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam rebuild_object_properties(zobj); } retval = zend_hash_update(zobj->properties, name, &EG(uninitialized_zval)); + // NOTE: retval will have type IS_NULL /* Notice is thrown after creation of the property, to avoid EG(std_property_info) * being overwritten in an error handler. */ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index a01f2c418aebd..9a607d4e1dcc3 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2601,6 +2601,15 @@ ZEND_VM_C_LABEL(try_assign_dim_array): FREE_OP_DATA(); } } else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) { +#if OP1_TYPE == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + ZEND_VM_C_GOTO(assign_dim_error); + } + } +#endif 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 70ebf54b4eeac..9720599e1c034 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -23396,6 +23396,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -23509,6 +23518,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -23622,6 +23640,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -23734,6 +23761,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -25974,6 +26010,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -26087,6 +26132,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -26200,6 +26254,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -26312,6 +26375,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -27341,6 +27413,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -27454,6 +27535,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -27567,6 +27657,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -27679,6 +27778,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -29900,6 +30008,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -30013,6 +30130,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -30126,6 +30252,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -30238,6 +30373,15 @@ 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 IS_VAR == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -40895,6 +41039,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -41008,6 +41161,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -41121,6 +41283,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -41233,6 +41404,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -44544,6 +44724,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -44657,6 +44846,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -44770,6 +44968,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -44882,6 +45089,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -46357,6 +46573,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -46470,6 +46695,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -46583,6 +46817,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -46695,6 +46938,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -49575,6 +49827,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -49688,6 +49949,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -49801,6 +50071,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) { @@ -49913,6 +50192,15 @@ 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 IS_CV == IS_CV + if (Z_TYPE_P(object_ptr) >= IS_NULL) { + zend_error(E_DEPRECATED, + "Automatic conversion of %s to array on field assignment is deprecated", Z_TYPE_P(object_ptr) == IS_NULL ? "null" : "false"); + if (UNEXPECTED(EG(exception))) { + goto assign_dim_error; + } + } +#endif 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))) {