summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
Diffstat (limited to 'Zend')
-rw-r--r--Zend/Zend.m416
-rw-r--r--Zend/tests/004.phpt3
-rw-r--r--Zend/tests/005.phpt3
-rw-r--r--Zend/tests/006.phpt4
-rw-r--r--Zend/tests/007.phpt65
-rw-r--r--Zend/tests/008.phpt25
-rw-r--r--Zend/tests/009.phpt28
-rw-r--r--Zend/tests/011.phpt7
-rw-r--r--Zend/tests/012.phpt9
-rw-r--r--Zend/tests/013.phpt9
-rw-r--r--Zend/tests/014.phpt10
-rw-r--r--Zend/tests/015.phpt8
-rw-r--r--Zend/tests/017.phpt23
-rw-r--r--Zend/tests/018.phpt13
-rw-r--r--Zend/tests/019.phpt216
-rw-r--r--Zend/tests/020.phpt8
-rw-r--r--Zend/tests/024.phpt32
-rw-r--r--Zend/tests/026.phpt11
-rw-r--r--Zend/tests/033.phpt56
-rw-r--r--Zend/tests/036.phpt21
-rw-r--r--Zend/tests/038.phpt12
-rw-r--r--Zend/tests/anonymous_func_001.phpt54
-rw-r--r--Zend/tests/anonymous_func_002.phpt19
-rw-r--r--Zend/tests/anonymous_func_003.phpt16
-rw-r--r--Zend/tests/arg_unpack/invalid_type.phpt72
-rw-r--r--Zend/tests/argument_restriction_001.phpt2
-rw-r--r--Zend/tests/argument_restriction_002.phpt2
-rw-r--r--Zend/tests/argument_restriction_003.phpt2
-rw-r--r--Zend/tests/argument_restriction_006.phpt2
-rw-r--r--Zend/tests/array_literal_next_element_error.phpt31
-rw-r--r--Zend/tests/array_offset.phpt2
-rw-r--r--Zend/tests/array_unpack/already_occupied.phpt48
-rw-r--r--Zend/tests/array_unpack/undef_var.phpt4
-rw-r--r--Zend/tests/arrow_functions/002.phpt2
-rw-r--r--Zend/tests/arrow_functions/003.phpt4
-rw-r--r--Zend/tests/assert/bug70208.phpt24
-rw-r--r--Zend/tests/assert/indirect_var_access_misoptimization.phpt21
-rw-r--r--Zend/tests/assign_dim_obj_null_return.phpt101
-rw-r--r--Zend/tests/assign_ref_error_var_handling.phpt31
-rw-r--r--Zend/tests/assign_to_var_003.phpt2
-rw-r--r--Zend/tests/bug26697.phpt2
-rw-r--r--Zend/tests/bug27669.phpt3
-rw-r--r--Zend/tests/bug29674.phpt2
-rw-r--r--Zend/tests/bug29689.phpt2
-rw-r--r--Zend/tests/bug29883.phpt2
-rw-r--r--Zend/tests/bug29890.phpt2
-rw-r--r--Zend/tests/bug29896.phpt4
-rw-r--r--Zend/tests/bug30162.phpt2
-rw-r--r--Zend/tests/bug31098.phpt2
-rw-r--r--Zend/tests/bug31102.phpt2
-rw-r--r--Zend/tests/bug31720.phpt11
-rw-r--r--Zend/tests/bug33116.phpt2
-rw-r--r--Zend/tests/bug34786.phpt6
-rw-r--r--Zend/tests/bug35017.phpt2
-rw-r--r--Zend/tests/bug35437.phpt27
-rw-r--r--Zend/tests/bug36268.phpt1
-rw-r--r--Zend/tests/bug36303.phpt14
-rw-r--r--Zend/tests/bug37138.phpt2
-rw-r--r--Zend/tests/bug37811.phpt7
-rw-r--r--Zend/tests/bug38047.phpt51
-rw-r--r--Zend/tests/bug38942.phpt18
-rw-r--r--Zend/tests/bug39003.phpt2
-rw-r--r--Zend/tests/bug39018.phpt40
-rw-r--r--Zend/tests/bug39036.phpt2
-rw-r--r--Zend/tests/bug39127.phpt22
-rw-r--r--Zend/tests/bug39304.phpt2
-rw-r--r--Zend/tests/bug40236.phpt1
-rw-r--r--Zend/tests/bug40621.phpt7
-rw-r--r--Zend/tests/bug40784.phpt25
-rw-r--r--Zend/tests/bug41075.phpt31
-rw-r--r--Zend/tests/bug41209.phpt2
-rw-r--r--Zend/tests/bug43201.phpt14
-rw-r--r--Zend/tests/bug43323.phpt14
-rw-r--r--Zend/tests/bug43344_1.phpt43
-rw-r--r--Zend/tests/bug44660.phpt56
-rw-r--r--Zend/tests/bug44899.phpt2
-rw-r--r--Zend/tests/bug45186.phpt11
-rw-r--r--Zend/tests/bug45186_2.phpt20
-rw-r--r--Zend/tests/bug45805.phpt2
-rw-r--r--Zend/tests/bug46106.phpt7
-rw-r--r--Zend/tests/bug46304.phpt45
-rw-r--r--Zend/tests/bug47054.phpt10
-rw-r--r--Zend/tests/bug47109.phpt4
-rw-r--r--Zend/tests/bug47320.phpt26
-rw-r--r--Zend/tests/bug47572.phpt5
-rw-r--r--Zend/tests/bug47836.phpt8
-rw-r--r--Zend/tests/bug47981.phpt17
-rw-r--r--Zend/tests/bug48004.phpt21
-rw-r--r--Zend/tests/bug48533.phpt10
-rw-r--r--Zend/tests/bug48693.phpt52
-rw-r--r--Zend/tests/bug49908.phpt2
-rw-r--r--Zend/tests/bug50261.phpt39
-rw-r--r--Zend/tests/bug51394.phpt2
-rw-r--r--Zend/tests/bug51827.phpt6
-rw-r--r--Zend/tests/bug52001.phpt4
-rw-r--r--Zend/tests/bug52041.phpt110
-rw-r--r--Zend/tests/bug52051.phpt34
-rw-r--r--Zend/tests/bug52160.phpt34
-rw-r--r--Zend/tests/bug52237.phpt11
-rw-r--r--Zend/tests/bug52614.phpt13
-rw-r--r--Zend/tests/bug54262.phpt17
-rw-r--r--Zend/tests/bug54265.phpt16
-rw-r--r--Zend/tests/bug54585.phpt17
-rw-r--r--Zend/tests/bug60536_001.phpt2
-rw-r--r--Zend/tests/bug60573.phpt30
-rw-r--r--Zend/tests/bug60573_2.phpt64
-rw-r--r--Zend/tests/bug60909_1.phpt2
-rw-r--r--Zend/tests/bug60978.phpt6
-rw-r--r--Zend/tests/bug61011.phpt2
-rw-r--r--Zend/tests/bug61095.phpt2
-rw-r--r--Zend/tests/bug61225.phpt2
-rw-r--r--Zend/tests/bug61767.phpt2
-rw-r--r--Zend/tests/bug62005.phpt17
-rw-r--r--Zend/tests/bug63336.phpt22
-rw-r--r--Zend/tests/bug63462.phpt8
-rw-r--r--Zend/tests/bug64960.phpt2
-rw-r--r--Zend/tests/bug64988.phpt3
-rw-r--r--Zend/tests/bug65322.phpt4
-rw-r--r--Zend/tests/bug66218.phpt1
-rw-r--r--Zend/tests/bug66609.phpt2
-rw-r--r--Zend/tests/bug67314.phpt4
-rw-r--r--Zend/tests/bug67436/b.inc4
-rw-r--r--Zend/tests/bug67436/bug67436.phpt4
-rw-r--r--Zend/tests/bug67436/bug67436_nohandler.phpt2
-rw-r--r--Zend/tests/bug67858.phpt21
-rw-r--r--Zend/tests/bug68446.phpt2
-rw-r--r--Zend/tests/bug69017.phpt8
-rw-r--r--Zend/tests/bug69388.phpt2
-rw-r--r--Zend/tests/bug69388_2.phpt2
-rw-r--r--Zend/tests/bug69732.phpt2
-rw-r--r--Zend/tests/bug69755.phpt5
-rw-r--r--Zend/tests/bug69767.phpt2
-rw-r--r--Zend/tests/bug69788.phpt7
-rw-r--r--Zend/tests/bug70124.phpt2
-rw-r--r--Zend/tests/bug70681.phpt2
-rw-r--r--Zend/tests/bug70895.phpt28
-rw-r--r--Zend/tests/bug70898.phpt26
-rw-r--r--Zend/tests/bug70957.phpt2
-rw-r--r--Zend/tests/bug71221.phpt12
-rw-r--r--Zend/tests/bug71300.phpt2
-rw-r--r--Zend/tests/bug71428.1.phpt2
-rw-r--r--Zend/tests/bug71428.3.phpt2
-rw-r--r--Zend/tests/bug71539_5.phpt9
-rw-r--r--Zend/tests/bug71841.phpt32
-rw-r--r--Zend/tests/bug72057.phpt2
-rw-r--r--Zend/tests/bug72101.phpt2
-rw-r--r--Zend/tests/bug72107.phpt12
-rw-r--r--Zend/tests/bug72911.phpt15
-rw-r--r--Zend/tests/bug72944.phpt5
-rw-r--r--Zend/tests/bug73163.phpt22
-rw-r--r--Zend/tests/bug73181.phpt21
-rw-r--r--Zend/tests/bug73338.phpt5
-rw-r--r--Zend/tests/bug74084.phpt27
-rw-r--r--Zend/tests/bug74340.phpt4
-rw-r--r--Zend/tests/bug74408.phpt34
-rw-r--r--Zend/tests/bug75241.phpt10
-rw-r--r--Zend/tests/bug75573.phpt8
-rw-r--r--Zend/tests/bug75921.phpt93
-rw-r--r--Zend/tests/bug76025.phpt2
-rw-r--r--Zend/tests/bug76534.phpt2
-rw-r--r--Zend/tests/bug76667.phpt12
-rw-r--r--Zend/tests/bug76860.phpt6
-rw-r--r--Zend/tests/bug76860_2.phpt6
-rw-r--r--Zend/tests/bug77494.phpt2
-rw-r--r--Zend/tests/bug77738.phpt5
-rw-r--r--Zend/tests/bug78182.phpt15
-rw-r--r--Zend/tests/bug78531.phpt45
-rw-r--r--Zend/tests/call_static_006.phpt14
-rw-r--r--Zend/tests/call_user_func_001.phpt20
-rw-r--r--Zend/tests/call_user_func_002.phpt42
-rw-r--r--Zend/tests/call_user_func_004.phpt22
-rw-r--r--Zend/tests/call_user_func_005.phpt3
-rw-r--r--Zend/tests/call_user_func_007.phpt2
-rw-r--r--Zend/tests/call_user_func_array_invalid_type.phpt18
-rw-r--r--Zend/tests/case_insensitive_constant_deprecation.phpt127
-rw-r--r--Zend/tests/cast_to_string.phptbin719 -> 727 bytes
-rw-r--r--Zend/tests/catch.phpt2
-rw-r--r--Zend/tests/class_exists_002.phpt6
-rw-r--r--Zend/tests/class_name_as_scalar_error_002.phpt7
-rw-r--r--Zend/tests/class_properties_const.phpt6
-rw-r--r--Zend/tests/clone_003.phpt2
-rw-r--r--Zend/tests/closure_012.phpt4
-rw-r--r--Zend/tests/closure_025.phpt13
-rw-r--r--Zend/tests/closure_027.phpt2
-rw-r--r--Zend/tests/closure_040.phpt11
-rw-r--r--Zend/tests/closure_061.phpt8
-rw-r--r--Zend/tests/closures/closure_from_callable_non_static_statically.phpt2
-rw-r--r--Zend/tests/concat_001.phpt20
-rw-r--r--Zend/tests/constant_expressions_classes.phpt2
-rw-r--r--Zend/tests/constant_expressions_invalid_offset_type_error.phpt2
-rw-r--r--Zend/tests/constants_002.phpt12
-rw-r--r--Zend/tests/constants_005.phpt7
-rw-r--r--Zend/tests/custom_assert_forbidden.phpt (renamed from Zend/tests/custom_assert_deprecation.phpt)2
-rw-r--r--Zend/tests/defined_fn_no_ns_fallback.phpt16
-rw-r--r--Zend/tests/dereference_002.phpt2
-rw-r--r--Zend/tests/dereference_007.phpt2
-rw-r--r--Zend/tests/dereference_010.phpt4
-rw-r--r--Zend/tests/dereference_014.phpt8
-rw-r--r--Zend/tests/dynamic_call_001.phpt22
-rw-r--r--Zend/tests/dynamic_call_004.phpt2
-rw-r--r--Zend/tests/dynamic_call_005.phpt37
-rw-r--r--Zend/tests/dynamic_call_006.phpt86
-rw-r--r--Zend/tests/dynamic_call_007.phpt10
-rw-r--r--Zend/tests/dynamic_call_008.phpt10
-rw-r--r--Zend/tests/each_001.phpt12
-rw-r--r--Zend/tests/each_002.phpt33
-rw-r--r--Zend/tests/each_003.phpt27
-rw-r--r--Zend/tests/entry_block_with_predecessors.phpt2
-rw-r--r--Zend/tests/errmsg_012.phpt11
-rw-r--r--Zend/tests/errmsg_013.phpt2
-rw-r--r--Zend/tests/errmsg_045.phpt6
-rw-r--r--Zend/tests/error_reporting03.phpt2
-rw-r--r--Zend/tests/error_reporting04.phpt2
-rw-r--r--Zend/tests/error_reporting05.phpt4
-rw-r--r--Zend/tests/error_reporting08.phpt2
-rw-r--r--Zend/tests/error_reporting09.phpt4
-rw-r--r--Zend/tests/error_reporting10.phpt1
-rw-r--r--Zend/tests/exception_012.phpt23
-rw-r--r--Zend/tests/exception_017.phpt22
-rw-r--r--Zend/tests/exception_handler_004.phpt6
-rw-r--r--Zend/tests/foreach_undefined.phpt2
-rw-r--r--Zend/tests/fr47160.phpt22
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal.phpt13
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt15
-rw-r--r--Zend/tests/generators/throw_not_an_exception.phpt7
-rw-r--r--Zend/tests/get_class_vars_002.phpt4
-rw-r--r--Zend/tests/globals_001.phpt2
-rw-r--r--Zend/tests/globals_002.phpt2
-rw-r--r--Zend/tests/globals_003.phpt2
-rw-r--r--Zend/tests/globals_004.phpt2
-rw-r--r--Zend/tests/halt_compiler5.phpt5
-rw-r--r--Zend/tests/illegal_offset_unset_isset_empty.phpt27
-rw-r--r--Zend/tests/incompat_ctx_user.phpt11
-rw-r--r--Zend/tests/indexing_001.phpt84
-rw-r--r--Zend/tests/indirect_call_array_005.phpt7
-rw-r--r--Zend/tests/indirect_call_string_003.phpt7
-rw-r--r--Zend/tests/inference_infinite_loop.phpt2
-rw-r--r--Zend/tests/instanceof.phpt2
-rw-r--r--Zend/tests/instanceof_001.phpt4
-rw-r--r--Zend/tests/interface_exists_001.phpt6
-rw-r--r--Zend/tests/is_a.phpt2
-rw-r--r--Zend/tests/isset_003.phpt8
-rw-r--r--Zend/tests/list_keyed_conversions.phpt2
-rw-r--r--Zend/tests/method_argument_binding.phpt2
-rw-r--r--Zend/tests/methods-on-non-objects-call-user-func.phpt15
-rw-r--r--Zend/tests/nowdoc_015.phpt2
-rw-r--r--Zend/tests/ns_041.phpt6
-rw-r--r--Zend/tests/ns_076.phpt38
-rw-r--r--Zend/tests/object_types/invalid_default_value.phpt2
-rw-r--r--Zend/tests/objects_002.phpt4
-rw-r--r--Zend/tests/objects_003.phpt4
-rw-r--r--Zend/tests/objects_004.phpt4
-rw-r--r--Zend/tests/objects_005.phpt4
-rw-r--r--Zend/tests/objects_006.phpt4
-rw-r--r--Zend/tests/objects_007.phpt4
-rw-r--r--Zend/tests/objects_008.phpt4
-rw-r--r--Zend/tests/objects_020.phpt26
-rw-r--r--Zend/tests/objects_027.phpt14
-rw-r--r--Zend/tests/offset_array.phpt22
-rw-r--r--Zend/tests/offset_bool.phpt18
-rw-r--r--Zend/tests/offset_long.phpt18
-rw-r--r--Zend/tests/offset_null.phpt18
-rw-r--r--Zend/tests/offset_string.phpt38
-rw-r--r--Zend/tests/overloaded_func_001.phpt10
-rw-r--r--Zend/tests/parse_str_with_unpack.phpt16
-rw-r--r--Zend/tests/php_errormsg_misoptimization.phpt22
-rw-r--r--Zend/tests/result_unused.phpt2
-rw-r--r--Zend/tests/return_types/023.phpt12
-rw-r--r--Zend/tests/return_types/bug71978.phpt10
-rw-r--r--Zend/tests/settype_string.phptbin745 -> 747 bytes
-rw-r--r--Zend/tests/str_offset_001.phpt8
-rw-r--r--Zend/tests/str_offset_003.phpt8
-rw-r--r--Zend/tests/strict_001.phpt2
-rw-r--r--Zend/tests/this_in_extract.phpt2
-rw-r--r--Zend/tests/this_in_mb_parse_str.phpt21
-rw-r--r--Zend/tests/this_in_parse_str.phpt19
-rw-r--r--Zend/tests/trait_exists_001.phpt6
-rw-r--r--Zend/tests/traits/bug55554a.phpt33
-rw-r--r--Zend/tests/traits/bug55554b.phpt55
-rw-r--r--Zend/tests/traits/bug55554c.phpt44
-rw-r--r--Zend/tests/traits/bug55554d.phpt29
-rw-r--r--Zend/tests/traits/bug55554e.phpt28
-rw-r--r--Zend/tests/traits/bug55554f.phpt27
-rw-r--r--Zend/tests/traits/bug55554g.phpt27
-rw-r--r--Zend/tests/traits/noctor001.phpt29
-rw-r--r--Zend/tests/type_declarations/callable_001.phpt20
-rw-r--r--Zend/tests/type_declarations/iterable_002.phpt2
-rw-r--r--Zend/tests/type_declarations/iterable_004.phpt2
-rw-r--r--Zend/tests/type_declarations/parameter_type_variance.phpt16
-rw-r--r--Zend/tests/type_declarations/parameter_type_variance_2.phpt22
-rw-r--r--Zend/tests/type_declarations/scalar_constant_defaults.phpt30
-rw-r--r--Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_004.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_005.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_013.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_014.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_020.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_029.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_030.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_034.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_038.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_039.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_040.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_046.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_047.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_051.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_054.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_056.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_057.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_058.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_060.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_068.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_069.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_070.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_074.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_075.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_078.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_091.phpt203
-rw-r--r--Zend/tests/type_declarations/typed_properties_093.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_095.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_096.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_103.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt10
-rw-r--r--Zend/tests/type_declarations/variance/parent_in_class.phpt47
-rw-r--r--Zend/tests/type_declarations/variance/parent_in_class_failure1.phpt16
-rw-r--r--Zend/tests/type_declarations/variance/parent_in_class_failure2.phpt17
-rw-r--r--Zend/tests/type_declarations/variance/parent_in_class_success.phpt27
-rw-r--r--Zend/tests/unset_cast_deprecated.phpt14
-rw-r--r--Zend/tests/unset_cast_removed.phpt12
-rw-r--r--Zend/tests/unset_cv01.phpt2
-rw-r--r--Zend/tests/unset_cv02.phpt2
-rw-r--r--Zend/tests/unset_cv03.phpt2
-rw-r--r--Zend/tests/unset_cv04.phpt2
-rw-r--r--Zend/tests/unset_cv05.phpt2
-rw-r--r--Zend/tests/unset_cv09.phpt2
-rw-r--r--Zend/tests/unset_cv10.phpt2
-rw-r--r--Zend/tests/varSyntax/propertyOfStringError.phpt2
-rw-r--r--Zend/tests/warning_during_heredoc_scan_ahead.phpt3
-rw-r--r--Zend/zend.c56
-rw-r--r--Zend/zend.h8
-rw-r--r--Zend/zend_API.c401
-rw-r--r--Zend/zend_API.h174
-rw-r--r--Zend/zend_ast.c17
-rw-r--r--Zend/zend_builtin_functions.c388
-rw-r--r--Zend/zend_builtin_functions.stub.php123
-rw-r--r--Zend/zend_builtin_functions_arginfo.h198
-rw-r--r--Zend/zend_closures.c74
-rw-r--r--Zend/zend_closures.stub.php17
-rw-r--r--Zend/zend_closures_arginfo.h24
-rw-r--r--Zend/zend_compile.c795
-rw-r--r--Zend/zend_compile.h51
-rw-r--r--Zend/zend_constants.c218
-rw-r--r--Zend/zend_constants.h24
-rw-r--r--Zend/zend_cpuinfo.h2
-rw-r--r--Zend/zend_errors.h8
-rw-r--r--Zend/zend_exceptions.c77
-rw-r--r--Zend/zend_exceptions.h1
-rw-r--r--Zend/zend_exceptions.stub.php68
-rw-r--r--Zend/zend_exceptions_arginfo.h55
-rw-r--r--Zend/zend_execute.c1147
-rw-r--r--Zend/zend_execute.h23
-rw-r--r--Zend/zend_execute_API.c86
-rw-r--r--Zend/zend_extensions.h2
-rw-r--r--Zend/zend_gc.c20
-rw-r--r--Zend/zend_gdb.c141
-rw-r--r--Zend/zend_gdb.h27
-rw-r--r--Zend/zend_generators.c34
-rw-r--r--Zend/zend_generators.stub.php20
-rw-r--r--Zend/zend_generators_arginfo.h22
-rw-r--r--Zend/zend_globals.h2
-rw-r--r--Zend/zend_hash.c27
-rw-r--r--Zend/zend_hash.h4
-rw-r--r--Zend/zend_highlight.h4
-rw-r--r--Zend/zend_inheritance.c185
-rw-r--r--Zend/zend_inheritance.h1
-rw-r--r--Zend/zend_interfaces.c75
-rw-r--r--Zend/zend_interfaces.h2
-rw-r--r--Zend/zend_interfaces.stub.php51
-rw-r--r--Zend/zend_interfaces_arginfo.h35
-rw-r--r--Zend/zend_iterators.c8
-rw-r--r--Zend/zend_language_parser.y4
-rw-r--r--Zend/zend_language_scanner.h2
-rw-r--r--Zend/zend_language_scanner.l17
-rw-r--r--Zend/zend_list.c13
-rw-r--r--Zend/zend_modules.h2
-rw-r--r--Zend/zend_object_handlers.c250
-rw-r--r--Zend/zend_object_handlers.h91
-rw-r--r--Zend/zend_objects.c8
-rw-r--r--Zend/zend_objects.h2
-rw-r--r--Zend/zend_objects_API.h2
-rw-r--r--Zend/zend_opcode.c1
-rw-r--r--Zend/zend_operators.c282
-rw-r--r--Zend/zend_operators.h70
-rw-r--r--Zend/zend_smart_str.c2
-rw-r--r--Zend/zend_smart_str.h2
-rw-r--r--Zend/zend_smart_str_public.h2
-rw-r--r--Zend/zend_smart_string.h2
-rw-r--r--Zend/zend_smart_string_public.h2
-rw-r--r--Zend/zend_string.h7
-rw-r--r--Zend/zend_ts_hash.c16
-rw-r--r--Zend/zend_ts_hash.h4
-rw-r--r--Zend/zend_type_info.h15
-rw-r--r--Zend/zend_types.h89
-rw-r--r--Zend/zend_virtual_cwd.c2
-rw-r--r--Zend/zend_virtual_cwd.h2
-rw-r--r--Zend/zend_vm_def.h935
-rw-r--r--Zend/zend_vm_execute.h10060
-rwxr-xr-xZend/zend_vm_gen.php336
-rw-r--r--Zend/zend_vm_handlers.h28
-rw-r--r--Zend/zend_vm_opcodes.c10
-rw-r--r--Zend/zend_vm_opcodes.h2
-rw-r--r--Zend/zend_weakrefs.c12
-rw-r--r--Zend/zend_weakrefs.h2
414 files changed, 8966 insertions, 12871 deletions
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index d6919ae1e1..57a12ac36b 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -157,6 +157,7 @@ AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <limits.h>
+#include <stdlib.h>
int main()
{
@@ -191,11 +192,11 @@ dnl LIBZEND_OTHER_CHECKS
dnl
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
-AC_ARG_ENABLE([maintainer-zts],
- [AS_HELP_STRING([--enable-maintainer-zts],
- [Enable thread safety - for code maintainers only!!])],
- [ZEND_MAINTAINER_ZTS=$enableval],
- [ZEND_MAINTAINER_ZTS=no])
+AC_ARG_ENABLE([zts],
+ [AS_HELP_STRING([--enable-zts],
+ [Enable thread safety])],
+ [ZEND_ZTS=$enableval],
+ [ZEND_ZTS=no])
AC_ARG_ENABLE([inline-optimization],
[AS_HELP_STRING([--disable-inline-optimization],
@@ -204,7 +205,7 @@ AC_ARG_ENABLE([inline-optimization],
[ZEND_INLINE_OPTIMIZATION=yes])
AC_MSG_CHECKING(whether to enable thread-safety)
-AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
+AC_MSG_RESULT($ZEND_ZTS)
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
@@ -225,7 +226,7 @@ fi
test -n "$GCC" && CFLAGS="$CFLAGS -Wall -Wno-strict-aliasing"
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
+if test "$ZEND_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
CFLAGS="$CFLAGS -DZTS"
fi
@@ -256,6 +257,7 @@ AC_MSG_CHECKING(for MM alignment and log values)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
+#include <stdlib.h>
typedef union _mm_align_test {
void *ptr;
diff --git a/Zend/tests/004.phpt b/Zend/tests/004.phpt
index 179684d076..2f733f1bd8 100644
--- a/Zend/tests/004.phpt
+++ b/Zend/tests/004.phpt
@@ -3,7 +3,6 @@ strncmp() tests
--FILE--
<?php
-var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
var_dump(strncmp("aef", "dfsgbdf", -1));
var_dump(strncmp("fghjkl", "qwer", 0));
@@ -13,8 +12,6 @@ var_dump(strncmp("qwerty", "qwerty123", 7));
echo "Done\n";
?>
--EXPECTF--
-Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
int(0)
Warning: Length must be greater than or equal to 0 in %s on line %d
diff --git a/Zend/tests/005.phpt b/Zend/tests/005.phpt
index 6ad1b0f63d..f4abfb6c51 100644
--- a/Zend/tests/005.phpt
+++ b/Zend/tests/005.phpt
@@ -3,7 +3,6 @@ strcasecmp() tests
--FILE--
<?php
-var_dump(strcasecmp(""));
var_dump(strcasecmp("", ""));
var_dump(strcasecmp("aef", "dfsgbdf"));
var_dump(strcasecmp("qwe", "qwer"));
@@ -15,8 +14,6 @@ var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
--EXPECTF--
-Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(0)
int(-3)
int(-1)
diff --git a/Zend/tests/006.phpt b/Zend/tests/006.phpt
index 64c74ff134..12907fd36e 100644
--- a/Zend/tests/006.phpt
+++ b/Zend/tests/006.phpt
@@ -3,7 +3,6 @@ strncasecmp() tests
--FILE--
<?php
-var_dump(strncasecmp(""));
var_dump(strncasecmp("", "", -1));
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
@@ -16,9 +15,6 @@ var_dump(strncasecmp("01", "01", 1000));
echo "Done\n";
?>
--EXPECTF--
-Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(0)
diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt
deleted file mode 100644
index 6120181269..0000000000
--- a/Zend/tests/007.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-each() tests
---FILE--
-<?php
-
-var_dump(each());
-$var = 1;
-var_dump(each($var));
-$var = "string";
-var_dump(each($var));
-$var = array(1,2,3);
-var_dump(each($var));
-$var = array("a"=>1,"b"=>2,"c"=>3);
-var_dump(each($var));
-
-$a = array(1);
-$a [] =&$a[0];
-
-var_dump(each($a));
-
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- string(1) "a"
- ["key"]=>
- string(1) "a"
-}
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/Zend/tests/008.phpt b/Zend/tests/008.phpt
index 0766c3e1a4..6f885c0dc5 100644
--- a/Zend/tests/008.phpt
+++ b/Zend/tests/008.phpt
@@ -3,12 +3,13 @@ define() tests
--FILE--
<?php
-var_dump(define());
-var_dump(define("TRUE"));
-var_dump(define("TRUE", 1));
-var_dump(define("TRUE", 1, array(1)));
+try {
+ var_dump(define(array(1,2,3,4,5), 1));
+} catch (TypeError $e) {
+ echo "TypeError: ", $e->getMessage(), "\n";
+}
-var_dump(define(array(1,2,3,4,5), 1));
+var_dump(define("TRUE", 1));
var_dump(define(" ", 1));
var_dump(define("[[[", 2));
var_dump(define("test const", 3));
@@ -24,18 +25,10 @@ var_dump(constant("test const"));
echo "Done\n";
?>
--EXPECTF--
-Warning: define() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: define() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-bool(true)
-
-Warning: define() expects parameter 3 to be bool, array given in %s on line %d
-NULL
+TypeError: define() expects parameter 1 to be string, array given
-Warning: define() expects parameter 1 to be string, array given in %s on line %d
-NULL
+Notice: Constant TRUE already defined in %s on line %d
+bool(false)
bool(true)
bool(true)
bool(true)
diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt
index 82cfabee49..15449df3d1 100644
--- a/Zend/tests/009.phpt
+++ b/Zend/tests/009.phpt
@@ -9,16 +9,17 @@ class foo {
}
function testNull ()
{
- var_dump(get_class(null));
+ try {
+ var_dump(get_class(null));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
class foo2 extends foo {
}
-foo::bar();
-foo2::bar();
-
$f1 = new foo;
$f2 = new foo2;
@@ -26,7 +27,11 @@ $f1->bar();
$f2->bar();
var_dump(get_class());
-var_dump(get_class("qwerty"));
+try {
+ var_dump(get_class("qwerty"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(get_class($f1));
var_dump(get_class($f2));
@@ -36,22 +41,13 @@ $f1->testNull();
echo "Done\n";
?>
--EXPECTF--
-Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
-string(3) "foo"
-
-Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
-string(3) "foo"
string(3) "foo"
string(3) "foo"
Warning: get_class() called without object from outside a class in %s on line %d
bool(false)
-
-Warning: get_class() expects parameter 1 to be object, string given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
string(3) "foo"
string(4) "foo2"
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Done
diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt
index 7bcab0798f..d36ae80ae8 100644
--- a/Zend/tests/011.phpt
+++ b/Zend/tests/011.phpt
@@ -23,8 +23,6 @@ class bar extends foo {
}
}
-var_dump(property_exists());
-var_dump(property_exists(""));
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
@@ -53,11 +51,6 @@ $bar->test();
echo "Done\n";
?>
--EXPECTF--
-Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
bool(true)
bool(true)
bool(true)
diff --git a/Zend/tests/012.phpt b/Zend/tests/012.phpt
index 40f68e9794..c238229066 100644
--- a/Zend/tests/012.phpt
+++ b/Zend/tests/012.phpt
@@ -6,10 +6,8 @@ class_exists() tests
class foo {
}
-var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
-var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
@@ -18,14 +16,9 @@ var_dump(class_exists("stdClass"));
echo "Done\n";
?>
---EXPECTF--
-Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
-
-Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
bool(true)
bool(true)
diff --git a/Zend/tests/013.phpt b/Zend/tests/013.phpt
index aec10e53f1..fd8320b536 100644
--- a/Zend/tests/013.phpt
+++ b/Zend/tests/013.phpt
@@ -6,10 +6,8 @@ interface_exists() tests
interface foo {
}
-var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
-var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
@@ -18,14 +16,9 @@ var_dump(interface_exists("stdClass"));
echo "Done\n";
?>
---EXPECTF--
-Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
-
-Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
bool(true)
bool(true)
diff --git a/Zend/tests/014.phpt b/Zend/tests/014.phpt
index a2c5335923..c02fee9385 100644
--- a/Zend/tests/014.phpt
+++ b/Zend/tests/014.phpt
@@ -8,13 +8,9 @@ var_dump(get_included_files());
include(__DIR__."/014.inc");
var_dump(get_included_files());
-var_dump(get_included_files(1,1));
-
include_once(__DIR__."/014.inc");
var_dump(get_included_files());
-var_dump(get_included_files(1));
-
include(__DIR__."/014.inc");
var_dump(get_included_files());
@@ -31,18 +27,12 @@ array(2) {
[1]=>
string(%d) "%s"
}
-
-Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d
-NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
-
-Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
array(2) {
[0]=>
string(%d) "%s"
diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt
index ccf5e4ddb0..deea89d14d 100644
--- a/Zend/tests/015.phpt
+++ b/Zend/tests/015.phpt
@@ -3,9 +3,7 @@ trigger_error() tests
--FILE--
<?php
-var_dump(trigger_error());
var_dump(trigger_error("error"));
-var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
@@ -14,15 +12,9 @@ var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
--EXPECTF--
-Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Notice: error in %s on line %d
bool(true)
-Warning: trigger_error() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
Warning: Invalid error type specified in %s on line %d
bool(false)
diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt
index ed1b2a38a5..619365cbce 100644
--- a/Zend/tests/017.phpt
+++ b/Zend/tests/017.phpt
@@ -3,8 +3,6 @@ builtin functions tests
--FILE--
<?php
-var_dump(get_resource_type());
-var_dump(get_resource_type(""));
$fp = fopen(__FILE__, "r");
var_dump(get_resource_type($fp));
fclose($fp);
@@ -14,11 +12,9 @@ var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
-var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
-var_dump(get_defined_constants(true, true));
var_dump(gettype(get_defined_constants(true)));
var_dump(gettype(get_defined_constants()));
var_dump(count(get_defined_constants()));
@@ -29,11 +25,9 @@ function test () {
var_dump(gettype(get_defined_functions()));
var_dump(count(get_defined_functions()));
-var_dump(get_declared_interfaces(true));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));
-var_dump(get_extension_funcs());
var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
@@ -44,36 +38,19 @@ var_dump(count(get_extension_funcs("zend")));
echo "Done\n";
?>
--EXPECTF--
-Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
-NULL
string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
-
-Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
-NULL
string(5) "array"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
-
-Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
string(5) "array"
int(%d)
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
bool(false)
string(5) "array"
int(%d)
diff --git a/Zend/tests/018.phpt b/Zend/tests/018.phpt
index 5ced729fce..97e53b1050 100644
--- a/Zend/tests/018.phpt
+++ b/Zend/tests/018.phpt
@@ -3,12 +3,8 @@ constant() tests
--FILE--
<?php
-var_dump(constant());
-var_dump(constant("", ""));
var_dump(constant(""));
-var_dump(constant(array()));
-
define("TEST_CONST", 1);
var_dump(constant("TEST_CONST"));
@@ -18,17 +14,8 @@ var_dump(constant("TEST_CONST2"));
echo "Done\n";
?>
--EXPECTF--
-Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: constant() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: constant(): Couldn't find constant in %s on line %d
NULL
-
-Warning: constant() expects parameter 1 to be string, array given in %s on line %d
-NULL
int(1)
string(4) "test"
Done
diff --git a/Zend/tests/019.phpt b/Zend/tests/019.phpt
index cde590734f..819fdc2c2b 100644
--- a/Zend/tests/019.phpt
+++ b/Zend/tests/019.phpt
@@ -368,7 +368,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -380,7 +380,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -392,7 +392,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -404,7 +404,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -416,7 +416,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -428,7 +428,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -440,7 +440,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -452,7 +452,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -464,7 +464,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -476,7 +476,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -488,7 +488,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -500,7 +500,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -512,7 +512,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -524,7 +524,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -536,7 +536,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -548,7 +548,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -560,7 +560,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -572,7 +572,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -584,7 +584,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -596,7 +596,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -608,7 +608,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -620,7 +620,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -632,7 +632,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -644,7 +644,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -656,7 +656,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -668,7 +668,7 @@ bool(true)
bool(true)
bool(false)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -680,7 +680,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: scalar_var in %s on line %d
+Warning: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -697,7 +697,7 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -713,18 +713,18 @@ bool(true)
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -740,18 +740,18 @@ bool(true)
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -767,18 +767,18 @@ bool(true)
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -794,18 +794,18 @@ bool(true)
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -827,13 +827,13 @@ array(3) {
int(4)
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(3) {
[1]=>
@@ -851,13 +851,13 @@ array(2) {
int(4)
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
[2]=>
@@ -871,13 +871,13 @@ array(1) {
int(4)
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
[3]=>
@@ -887,18 +887,18 @@ array(1) {
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -918,13 +918,13 @@ array(2) {
float(5.6)
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
[1]=>
@@ -938,13 +938,13 @@ array(1) {
float(5.6)
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
[2]=>
@@ -954,18 +954,18 @@ array(1) {
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -983,13 +983,13 @@ array(1) {
string(3) "two"
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
[2]=>
@@ -999,18 +999,18 @@ array(1) {
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -1028,13 +1028,13 @@ array(1) {
string(2) "30"
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
["Age"]=>
@@ -1044,18 +1044,18 @@ array(1) {
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -1079,13 +1079,13 @@ array(4) {
string(0) ""
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(4) {
[1]=>
@@ -1107,13 +1107,13 @@ array(3) {
string(0) ""
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(3) {
["One"]=>
@@ -1131,13 +1131,13 @@ array(2) {
string(0) ""
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
[2]=>
@@ -1151,13 +1151,13 @@ array(1) {
string(0) ""
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
[""]=>
@@ -1167,18 +1167,18 @@ array(1) {
array(0) {
}
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(false)
-Notice: Undefined variable: key_val in %s on line %d
+Warning: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}
-Notice: Undefined variable: array_var in %s on line %d
+Warning: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
@@ -1196,7 +1196,7 @@ bool(true)
bool(false)
bool(false)
-Notice: Undefined variable: resource in %s on line %d
+Warning: Undefined variable: resource in %s on line %d
NULL
-- Iteration 2 --
resource(%d) of type (stream)
@@ -1209,10 +1209,10 @@ bool(true)
bool(false)
bool(false)
-Notice: Undefined variable: resource in %s on line %d
+Warning: Undefined variable: resource in %s on line %d
NULL
-Notice: Undefined variable: resources in %s on line %d
+Warning: Undefined variable: resources in %s on line %d
NULL
bool(false)
bool(true)
@@ -1229,16 +1229,16 @@ object(Point)#%d (3) {
bool(true)
bool(false)
-Notice: Undefined variable: lable in %s on line %d
+Warning: Undefined variable: lable in %s on line %d
bool(false)
-Notice: Undefined variable: lable in %s on line %d
+Warning: Undefined variable: lable in %s on line %d
bool(true)
-Notice: Undefined variable: lable in %s on line %d
+Warning: Undefined variable: lable in %s on line %d
bool(false)
-Notice: Undefined variable: lable in %s on line %d
+Warning: Undefined variable: lable in %s on line %d
bool(true)
object(Point)#%d (3) {
["x"]=>
@@ -1263,7 +1263,7 @@ bool(false)
bool(false)
bool(true)
-Notice: Undefined variable: point1 in %s on line %d
+Warning: Undefined variable: point1 in %s on line %d
NULL
bool(false)
bool(true)
@@ -1293,7 +1293,7 @@ value of static_var before unset: 1
bool(true)
bool(false)
-Notice: Undefined variable: static_var in %s on line %d
+Warning: Undefined variable: static_var in %s on line %d
value of static_var after unset:
bool(false)
bool(true)
@@ -1302,7 +1302,7 @@ value of static_var before unset: 2
bool(true)
bool(false)
-Notice: Undefined variable: static_var in %s on line %d
+Warning: Undefined variable: static_var in %s on line %d
value of static_var after unset:
bool(false)
bool(true)
@@ -1311,7 +1311,7 @@ value of static_var before unset: 3
bool(true)
bool(false)
-Notice: Undefined variable: static_var in %s on line %d
+Warning: Undefined variable: static_var in %s on line %d
value of static_var after unset:
bool(false)
bool(true)
diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt
index 1e2bcff387..efc221cb4f 100644
--- a/Zend/tests/020.phpt
+++ b/Zend/tests/020.phpt
@@ -3,9 +3,7 @@ func_get_arg() invalid usage
--FILE--
<?php
-var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
-var_dump(func_get_arg());
function bar() {
var_dump(func_get_arg(1));
@@ -20,15 +18,9 @@ foo(1,2);
echo "Done\n";
?>
--EXPECTF--
-Warning: func_get_arg() expects exactly 1 parameter, 3 given in %s on line %d
-NULL
-
Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
bool(false)
-Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Done
diff --git a/Zend/tests/024.phpt b/Zend/tests/024.phpt
index 9e647d4231..d4e34972ee 100644
--- a/Zend/tests/024.phpt
+++ b/Zend/tests/024.phpt
@@ -15,43 +15,43 @@ var_dump($a->$b->{$c[1]});
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
int(1)
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
int(0)
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
int(1)
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
NULL
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
NULL
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
-Notice: Trying to get property '' of non-object in %s on line %d
+Warning: Trying to get property '' of non-object in %s on line %d
NULL
diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt
index b3088e8473..0524487c5f 100644
--- a/Zend/tests/026.phpt
+++ b/Zend/tests/026.phpt
@@ -13,13 +13,16 @@ $test = new foo;
$test->a()->a;
print "ok\n";
-$test->a()->a = 1;
+try {
+ $test->a()->a = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
print "ok\n";
?>
--EXPECTF--
-Notice: Trying to get property 'a' of non-object in %s on line %d
+Warning: Trying to get property 'a' of non-object in %s on line %d
ok
-
-Warning: Creating default object from empty value in %s on line %d
+Attempt to assign property 'a' of non-object
ok
diff --git a/Zend/tests/033.phpt b/Zend/tests/033.phpt
index 1e7fca1e0d..652db2de20 100644
--- a/Zend/tests/033.phpt
+++ b/Zend/tests/033.phpt
@@ -9,52 +9,58 @@ echo $arr[1][2][3][4][5];
$arr[1][2][3][4][5]->foo;
-$arr[1][2][3][4][5]->foo = 1;
+try {
+ $arr[1][2][3][4][5]->foo = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr[][] = 2;
-$arr[][]->bar = 2;
+try {
+ $arr[][]->bar = 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property 'foo' of non-object in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
+Warning: Trying to get property 'foo' of non-object in %s on line %d
+Attempt to assign property 'foo' of non-object
+Attempt to assign property 'bar' of non-object
diff --git a/Zend/tests/036.phpt b/Zend/tests/036.phpt
index 3ff522b16f..6b6549d935 100644
--- a/Zend/tests/036.phpt
+++ b/Zend/tests/036.phpt
@@ -3,14 +3,19 @@ Trying to use lambda in array offset
--FILE--
<?php
-$test[function(){}] = 1;
-$a{function() { }} = 1;
+try {
+ $test[function(){}] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a{function() { }} = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
+Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d
+Illegal offset type
+Illegal offset type
diff --git a/Zend/tests/038.phpt b/Zend/tests/038.phpt
index 963e73f9ea..e55757bbcd 100644
--- a/Zend/tests/038.phpt
+++ b/Zend/tests/038.phpt
@@ -3,10 +3,12 @@ Trying to use lambda as array key
--FILE--
<?php
-var_dump(array(function() { } => 1));
+try {
+ var_dump(array(function() { } => 1));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Illegal offset type in %s on line %d
-array(0) {
-}
+--EXPECT--
+Illegal offset type
diff --git a/Zend/tests/anonymous_func_001.phpt b/Zend/tests/anonymous_func_001.phpt
deleted file mode 100644
index 97b91b6544..0000000000
--- a/Zend/tests/anonymous_func_001.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-Testing calls to anonymous function
---FILE--
-<?php
-
-for ($i = 0; $i < 10; $i++) {
- $a = create_function('', 'return '. $i .';');
- var_dump($a());
-
- $b = "\0lambda_". ($i + 1);
- var_dump($b());
-}
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(0)
-int(0)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(1)
-int(1)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(2)
-int(2)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(3)
-int(3)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(4)
-int(4)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(5)
-int(5)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(6)
-int(6)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(7)
-int(7)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(8)
-int(8)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(9)
-int(9)
diff --git a/Zend/tests/anonymous_func_002.phpt b/Zend/tests/anonymous_func_002.phpt
deleted file mode 100644
index 28adc357da..0000000000
--- a/Zend/tests/anonymous_func_002.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Testing anonymous function return as array key and accessing $GLOBALS
---FILE--
-<?php
-
-$test = create_function('$v', 'return $v;');
-
-$arr = array(create_function('', 'return $GLOBALS["arr"];'), 2);
-
-var_dump($arr[$test(1)]);
-var_dump($arr[$test(0)]() == $arr);
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(2)
-bool(true)
diff --git a/Zend/tests/anonymous_func_003.phpt b/Zend/tests/anonymous_func_003.phpt
deleted file mode 100644
index d2610310f7..0000000000
--- a/Zend/tests/anonymous_func_003.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Using throw $var with anonymous function return
---FILE--
-<?php
-
-try {
- $a = create_function('', 'return new Exception("test");');
- throw $a();
-} catch (Exception $e) {
- var_dump($e->getMessage() == 'test');
-}
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-bool(true)
diff --git a/Zend/tests/arg_unpack/invalid_type.phpt b/Zend/tests/arg_unpack/invalid_type.phpt
index 1ef545558c..ad580c37ae 100644
--- a/Zend/tests/arg_unpack/invalid_type.phpt
+++ b/Zend/tests/arg_unpack/invalid_type.phpt
@@ -7,53 +7,37 @@ function test(...$args) {
var_dump($args);
}
-test(...null);
-test(...42);
-test(...new stdClass);
-
-test(1, 2, 3, ..."foo", ...[4, 5]);
-test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
-
-?>
---EXPECTF--
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-array(0) {
+try {
+ test(...null);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-array(0) {
+try {
+ test(...42);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-array(0) {
+try {
+ test(...new stdClass);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
+try {
+ test(1, 2, 3, ..."foo", ...[4, 5]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-
-Warning: Only arrays and Traversables can be unpacked in %s on line %d
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
+try {
+ test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
+
+?>
+--EXPECT--
+Only arrays and Traversables can be unpacked
+Only arrays and Traversables can be unpacked
+Only arrays and Traversables can be unpacked
+Only arrays and Traversables can be unpacked
+Only arrays and Traversables can be unpacked
diff --git a/Zend/tests/argument_restriction_001.phpt b/Zend/tests/argument_restriction_001.phpt
index 9c21dc2cce..2cd527f4fa 100644
--- a/Zend/tests/argument_restriction_001.phpt
+++ b/Zend/tests/argument_restriction_001.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of & Sub::test() should be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
+Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
diff --git a/Zend/tests/argument_restriction_002.phpt b/Zend/tests/argument_restriction_002.phpt
index 4deb2d206b..511e4d3332 100644
--- a/Zend/tests/argument_restriction_002.phpt
+++ b/Zend/tests/argument_restriction_002.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test($foo, array &$bar) should be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
+Fatal error: Declaration of Sub::test($foo, array &$bar) must be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
diff --git a/Zend/tests/argument_restriction_003.phpt b/Zend/tests/argument_restriction_003.phpt
index c24e0ba852..fb602194bb 100644
--- a/Zend/tests/argument_restriction_003.phpt
+++ b/Zend/tests/argument_restriction_003.phpt
@@ -16,4 +16,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test() should be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
+Fatal error: Declaration of Sub::test() must be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
diff --git a/Zend/tests/argument_restriction_006.phpt b/Zend/tests/argument_restriction_006.phpt
index 2df0e1e90d..788670cd51 100644
--- a/Zend/tests/argument_restriction_006.phpt
+++ b/Zend/tests/argument_restriction_006.phpt
@@ -13,4 +13,4 @@ class Sub extends Base {
}
?>
--EXPECTF--
-Warning: Declaration of Sub::test($foo, $extra) should be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
+Fatal error: Declaration of Sub::test($foo, $extra) must be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
diff --git a/Zend/tests/array_literal_next_element_error.phpt b/Zend/tests/array_literal_next_element_error.phpt
index 8b4af3cadd..23dec5e22c 100644
--- a/Zend/tests/array_literal_next_element_error.phpt
+++ b/Zend/tests/array_literal_next_element_error.phpt
@@ -4,22 +4,21 @@ Next free element may overflow in array literals
<?php
$i = PHP_INT_MAX;
-$array = [$i => 42, new stdClass];
-var_dump($array);
-
-const FOO = [PHP_INT_MAX => 42, "foo"];
-var_dump(FOO);
-
-?>
---EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(1) {
- [%d]=>
- int(42)
+try {
+ $array = [$i => 42, new stdClass];
+ var_dump($array);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(1) {
- [%d]=>
- int(42)
+function test($x = [PHP_INT_MAX => 42, "foo"]) {}
+try {
+ test();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
+
+?>
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_offset.phpt b/Zend/tests/array_offset.phpt
index 0879f80918..0a86bf7e9c 100644
--- a/Zend/tests/array_offset.phpt
+++ b/Zend/tests/array_offset.phpt
@@ -1,5 +1,5 @@
--TEST--
-Ensure "undefined offset" notice formats message corectly when undefined key is negative
+Ensure "undefined offset" notice formats message correctly when undefined key is negative
--FILE--
<?php
diff --git a/Zend/tests/array_unpack/already_occupied.phpt b/Zend/tests/array_unpack/already_occupied.phpt
index 27a18b6ced..b2febe0021 100644
--- a/Zend/tests/array_unpack/already_occupied.phpt
+++ b/Zend/tests/array_unpack/already_occupied.phpt
@@ -6,36 +6,28 @@ Appending to an array via unpack may fail
<?php
$arr = [1, 2, 3];
-var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
-
-var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
-
-const ARR = [1, 2, 3];
-const ARR2 = [PHP_INT_MAX-1 => 0, ...ARR];
-var_dump(ARR2);
-
-?>
---EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+try {
+ var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+try {
+ var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+const ARR = [1, 2, 3];
+function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {}
+try {
+ test();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
+
+?>
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_unpack/undef_var.phpt b/Zend/tests/array_unpack/undef_var.phpt
index fff1f6171e..945717db76 100644
--- a/Zend/tests/array_unpack/undef_var.phpt
+++ b/Zend/tests/array_unpack/undef_var.phpt
@@ -6,9 +6,9 @@ array unpacking with undefinded variable
var_dump([...$arr]);
--EXPECTF--
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
Fatal error: Uncaught Error: Only arrays and Traversables can be unpacked in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line %d \ No newline at end of file
+ thrown in %s on line %d
diff --git a/Zend/tests/arrow_functions/002.phpt b/Zend/tests/arrow_functions/002.phpt
index 52c8020c19..76254fc69a 100644
--- a/Zend/tests/arrow_functions/002.phpt
+++ b/Zend/tests/arrow_functions/002.phpt
@@ -9,5 +9,5 @@ var_dump((fn() => $b + $c)());
?>
--EXPECTF--
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
int(1)
diff --git a/Zend/tests/arrow_functions/003.phpt b/Zend/tests/arrow_functions/003.phpt
index 5e77743fad..4e6998c9d1 100644
--- a/Zend/tests/arrow_functions/003.phpt
+++ b/Zend/tests/arrow_functions/003.phpt
@@ -14,8 +14,8 @@ var_dump($fn());
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Notice: Undefined variable: 5 in %s on line %d
+Warning: Undefined variable: 5 in %s on line %d
NULL
diff --git a/Zend/tests/assert/bug70208.phpt b/Zend/tests/assert/bug70208.phpt
deleted file mode 100644
index 6b7dfaeb33..0000000000
--- a/Zend/tests/assert/bug70208.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #70208 (scope information must be preserved with assert())
---FILE--
-<?php
-
-function non_class_scope() {
- return true;
-}
-
-class test {
- protected $prop = 1;
-
- public function __construct() {
- assert('non_class_scope();');
- var_dump($this->prop);
- }
-}
-
-new test;
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-int(1)
diff --git a/Zend/tests/assert/indirect_var_access_misoptimization.phpt b/Zend/tests/assert/indirect_var_access_misoptimization.phpt
deleted file mode 100644
index 02327f30c0..0000000000
--- a/Zend/tests/assert/indirect_var_access_misoptimization.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Misoptimization when variable is modified by assert()
---INI--
-zend.assertions=1
---FILE--
-<?php
-
-function test() {
- $i = 0;
- assert('$i = new stdClass');
- $i += 1;
- var_dump($i);
-}
-test();
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Notice: Object of class stdClass could not be converted to number in %s on line %d
-int(2)
diff --git a/Zend/tests/assign_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt
index cff877fd8f..1641992a0c 100644
--- a/Zend/tests/assign_dim_obj_null_return.phpt
+++ b/Zend/tests/assign_dim_obj_null_return.phpt
@@ -7,50 +7,77 @@ function test() {
$array = [PHP_INT_MAX => 42];
$true = true;
- var_dump($array[] = 123);
- var_dump($array[[]] = 123);
- var_dump($array[new stdClass] = 123);
- var_dump($true[123] = 456);
-
- var_dump($array[] += 123);
- var_dump($array[[]] += 123);
- var_dump($array[new stdClass] += 123);
- var_dump($true[123] += 456);
-
- var_dump($true->foo = 123);
- var_dump($true->foo += 123);
-}
-
-test();
+ try {
+ var_dump($array[] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-?>
---EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-NULL
+ try {
+ var_dump($array[[]] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($array[new stdClass] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($true[123] = 456);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot use a scalar value as an array in %s on line %d
-NULL
+ try {
+ var_dump($array[] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-NULL
+ try {
+ var_dump($array[[]] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($array[new stdClass] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($true[123] += 456);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot use a scalar value as an array in %s on line %d
-NULL
+ try {
+ var_dump($true->foo = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump($true->foo += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
-Warning: Attempt to assign property 'foo' of non-object in %s on line %d
-NULL
+test();
-Warning: Attempt to assign property 'foo' of non-object in %s on line %d
-NULL
+?>
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+Illegal offset type
+Illegal offset type
+Cannot use a scalar value as an array
+Cannot add element to the array as the next element is already occupied
+Illegal offset type
+Illegal offset type
+Cannot use a scalar value as an array
+Attempt to assign property 'foo' of non-object
+Attempt to assign property 'foo' of non-object
diff --git a/Zend/tests/assign_ref_error_var_handling.phpt b/Zend/tests/assign_ref_error_var_handling.phpt
index 5ecb577ba7..2a66b68cc5 100644
--- a/Zend/tests/assign_ref_error_var_handling.phpt
+++ b/Zend/tests/assign_ref_error_var_handling.phpt
@@ -7,19 +7,24 @@ function val() {
return 42;
}
-$str = "foo";
$var = 24;
-var_dump($str->foo =& $var);
-var_dump($str);
-var_dump($str->foo =& val());
-var_dump($str);
+$arr = [PHP_INT_MAX => "foo"];
+try {
+ var_dump($arr[] =& $var);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump(count($arr));
+try {
+ var_dump($arr[] =& val());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump(count($arr));
?>
---EXPECTF--
-Warning: Attempt to modify property 'foo' of non-object in %s on line %d
-NULL
-string(3) "foo"
-
-Warning: Attempt to modify property 'foo' of non-object in %s on line %d
-NULL
-string(3) "foo"
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+int(1)
+Cannot add element to the array as the next element is already occupied
+int(1)
diff --git a/Zend/tests/assign_to_var_003.phpt b/Zend/tests/assign_to_var_003.phpt
index bbe1b372bb..3ecf89e172 100644
--- a/Zend/tests/assign_to_var_003.phpt
+++ b/Zend/tests/assign_to_var_003.phpt
@@ -13,7 +13,7 @@ var_dump($var1);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type float in %s on line %d
+Warning: Trying to access array offset on value of type float in %s on line %d
NULL
NULL
Done
diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt
index fe269c0364..c0a4850e55 100644
--- a/Zend/tests/bug26697.phpt
+++ b/Zend/tests/bug26697.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
+Bug #26697 (calling class_exists on a nonexistent class in autoloader results in segfault)
--FILE--
<?php
diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt
index 97b15590e2..747593031f 100644
--- a/Zend/tests/bug27669.phpt
+++ b/Zend/tests/bug27669.phpt
@@ -3,7 +3,7 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
--FILE--
<?php
class A {
- function hello() {
+ static function hello() {
echo "Hello World\n";
}
}
@@ -12,6 +12,5 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
?>
===DONE===
--EXPECTF--
-Deprecated: Non-static method A::hello() should not be called statically in %s on line %d
Hello World
===DONE===
diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt
index 60f08a6df2..f1706cabb7 100644
--- a/Zend/tests/bug29674.phpt
+++ b/Zend/tests/bug29674.phpt
@@ -33,7 +33,7 @@ $obj->printVars();
===BASE===
string(4) "Base"
-Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d
+Warning: Undefined property: BaseClass::$private_child in %s on line %d
NULL
===CHILD===
string(4) "Base"
diff --git a/Zend/tests/bug29689.phpt b/Zend/tests/bug29689.phpt
index 12b3430089..16f80440d4 100644
--- a/Zend/tests/bug29689.phpt
+++ b/Zend/tests/bug29689.phpt
@@ -52,7 +52,7 @@ $baz->printFoo();
--EXPECTF--
foo: foo foo2
bar: bar
-Notice: Undefined property: bar::$foo2 in %s on line %d
+Warning: Undefined property: bar::$foo2 in %s on line %d
---baz--
foo: foo foo2
diff --git a/Zend/tests/bug29883.phpt b/Zend/tests/bug29883.phpt
index 4e07b02d10..d9e1ae43b1 100644
--- a/Zend/tests/bug29883.phpt
+++ b/Zend/tests/bug29883.phpt
@@ -15,7 +15,7 @@ bool(false)
bool(true)
bool(true)
-Notice: Uninitialized string offset: -10 in %s on line 6
+Warning: Uninitialized string offset: -10 in %s on line %d
string(0) ""
string(1) "u"
string(1) "u"
diff --git a/Zend/tests/bug29890.phpt b/Zend/tests/bug29890.phpt
index 1fdcdc4291..6f1e874882 100644
--- a/Zend/tests/bug29890.phpt
+++ b/Zend/tests/bug29890.phpt
@@ -2,7 +2,7 @@
Bug #29890 (crash if error handler fails)
--FILE--
<?php
-function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine,$fClass) {
+function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine) {
echo "error :".$fErrStr."\n";
}
diff --git a/Zend/tests/bug29896.phpt b/Zend/tests/bug29896.phpt
index 35a92d459c..6b96ac4704 100644
--- a/Zend/tests/bug29896.phpt
+++ b/Zend/tests/bug29896.phpt
@@ -2,7 +2,7 @@
Bug #29896 (Backtrace argument list out of sync)
--FILE--
<?php
-function userErrorHandler($num, $msg, $file, $line, $vars)
+function userErrorHandler($num, $msg, $file, $line)
{
debug_print_backtrace();
}
@@ -22,6 +22,6 @@ function GenerateError2($A1)
GenerateError2("Test2");
?>
--EXPECTF--
-#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11]
+#0 userErrorHandler(2, Undefined variable: b, %s, %d) called at [%s:%d]
#1 GenerateError1(Test1) called at [%sbug29896.php:16]
#2 GenerateError2(Test2) called at [%sbug29896.php:19]
diff --git a/Zend/tests/bug30162.phpt b/Zend/tests/bug30162.phpt
index 55d26a3e3a..cd0ca4872e 100644
--- a/Zend/tests/bug30162.phpt
+++ b/Zend/tests/bug30162.phpt
@@ -43,7 +43,7 @@ var_dump($db);
?>
===DONE===
--EXPECTF--
-Notice: Undefined variable: db in %sbug30162.php on line 35
+Warning: Undefined variable: db in %s on line %d
NULL
object(hariCow)#%d (2) {
["x"]=>
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt
index 1849528231..3276782c01 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -44,7 +44,7 @@ ok
ok
ok
-Notice: Trying to get property 'wrong' of non-object in %s on line %d
+Warning: Trying to get property 'wrong' of non-object in %s on line %d
ok
Warning: Illegal string offset 'wrong' in %s on line %d
diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt
index fd6da0f7c2..624eee52ba 100644
--- a/Zend/tests/bug31102.phpt
+++ b/Zend/tests/bug31102.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31102 (Exception not handled when thrown inside __autoload())
+Bug #31102 (Exception not handled when thrown inside autoloader)
--FILE--
<?php
diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt
index c4680a4789..b5e935cd80 100644
--- a/Zend/tests/bug31720.phpt
+++ b/Zend/tests/bug31720.phpt
@@ -4,11 +4,14 @@ Bug #31720 (Invalid object callbacks not caught in array_walk())
<?php
$array = array('at least one element');
-array_walk($array, array($nonesuchvar,'show'));
+try {
+ array_walk($array, array($nonesuchvar,'show'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
===DONE===
--EXPECTF--
-Notice: Undefined variable: nonesuchvar in %s on line %d
-
-Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+Warning: Undefined variable: nonesuchvar in %s on line %d
+array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object
===DONE===
diff --git a/Zend/tests/bug33116.phpt b/Zend/tests/bug33116.phpt
index 13aae6611e..b336171165 100644
--- a/Zend/tests/bug33116.phpt
+++ b/Zend/tests/bug33116.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33116 (crash when assigning class name to global variable in __autoload)
+Bug #33116 (crash when assigning class name to global variable in autoloader)
--FILE--
<?php
spl_autoload_register(function ($class) {
diff --git a/Zend/tests/bug34786.phpt b/Zend/tests/bug34786.phpt
index 18642848d8..ef0627633f 100644
--- a/Zend/tests/bug34786.phpt
+++ b/Zend/tests/bug34786.phpt
@@ -10,13 +10,13 @@ function bar() {
echo "bar: ".error_reporting()."\n";
}
-error_reporting(1);
+error_reporting(E_WARNING);
echo "before: ".error_reporting()."\n";
@foo(1,@bar(),3);
echo "after: ".error_reporting()."\n";
?>
--EXPECT--
-before: 1
+before: 2
bar: 0
foo: 0
-after: 1
+after: 2
diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt
index 9944df55e0..8a747be7e1 100644
--- a/Zend/tests/bug35017.phpt
+++ b/Zend/tests/bug35017.phpt
@@ -13,7 +13,7 @@ try {
} catch(Exception $e) {
echo "This Exception should be caught\n";
}
-function errorHandler($errno, $errstr, $errfile, $errline, $vars) {
+function errorHandler($errno, $errstr, $errfile, $errline) {
throw new Exception('Some Exception');
}
?>
diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt
deleted file mode 100644
index 4f61e4fbfd..0000000000
--- a/Zend/tests/bug35437.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #35437 (Segfault or Invalid Opcode 137/1/4)
---FILE--
-<?php
-function err2exception($errno, $errstr)
-{
- throw new Exception("Error occuried: " . $errstr);
-}
-
-set_error_handler('err2exception');
-
-class TestClass
-{
- function testMethod()
- {
- $GLOBALS['t'] = new stdClass;
- }
-}
-
-try {
- TestClass::testMethod();
-} catch (Exception $e) {
- echo "Caught: ".$e->getMessage()."\n";
-}
-?>
---EXPECT--
-Caught: Error occuried: Non-static method TestClass::testMethod() should not be called statically
diff --git a/Zend/tests/bug36268.phpt b/Zend/tests/bug36268.phpt
index 8c93186c73..3bec61ff49 100644
--- a/Zend/tests/bug36268.phpt
+++ b/Zend/tests/bug36268.phpt
@@ -15,3 +15,4 @@ Fatal error: Uncaught Error: Call to undefined function bar() in %sbug36268.php:
Stack trace:
#0 {main}
thrown in %sbug36268.php on line 8
+Ha!
diff --git a/Zend/tests/bug36303.phpt b/Zend/tests/bug36303.phpt
deleted file mode 100644
index 3ea036a838..0000000000
--- a/Zend/tests/bug36303.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Bug #36303 (foreach on error_zval produces segfault)
---FILE--
-<?php
-$x="test";
-foreach($x->a->b as &$v) {
-}
-echo "ok\n";
-?>
---EXPECTF--
-Warning: Attempt to modify property 'a' of non-object in %sbug36303.php on line 3
-
-Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3
-ok
diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt
index 4a084d4bb1..c0aa1fdfa8 100644
--- a/Zend/tests/bug37138.phpt
+++ b/Zend/tests/bug37138.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #37138 (__autoload tries to load callback'ed self and parent)
+Bug #37138 (autoloader tries to load callback'ed self and parent)
--FILE--
<?php
spl_autoload_register(function ($CN) { var_dump ($CN); });
diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt
index 96645d0354..8321459d5d 100644
--- a/Zend/tests/bug37811.phpt
+++ b/Zend/tests/bug37811.phpt
@@ -23,6 +23,7 @@ string(3) "Foo"
Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d
-Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d
-string(3) "Baz"
-===DONE===
+Fatal error: Uncaught Error: Undefined constant 'Baz' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug38047.phpt b/Zend/tests/bug38047.phpt
deleted file mode 100644
index e6eeb6631d..0000000000
--- a/Zend/tests/bug38047.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler)
---FILE--
-<?php
-error_reporting(E_ALL);
-set_error_handler('kalus_error_handler');
-ini_set("display_errors", "on");
-
-class A {
- function A_ftk($a) {
- }
-}
-
-function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) {
- echo "$error_string\n";
- get_error_context();
-}
-
-function get_error_context() {
- $backtrace = debug_backtrace();
- $n = 1;
- foreach ($backtrace as $call) {
- echo $n++." ";
- if (isset($call["file"])) {
- echo $call["file"];
- if (isset($call["line"])) {
- echo ":".$call["line"];
- }
- }
- if (isset($call["function"])) {
- echo " ".$call["function"]."()";
- }
- echo "\n";
- }
- echo "\n";
-}
-
-//This will not create file and line items for the call into the error handler
-$page["name"] = A::A_ftk();
-?>
---EXPECTF--
-Non-static method A::A_ftk() should not be called statically
-1 %sbug38047.php:13 get_error_context()
-2 %sbug38047.php:36 kalus_error_handler()
-
-
-Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7
-Stack trace:
-#0 %sbug38047.php(36): A::A_ftk()
-#1 {main}
- thrown in %sbug38047.php on line 7
diff --git a/Zend/tests/bug38942.phpt b/Zend/tests/bug38942.phpt
deleted file mode 100644
index d0335b1071..0000000000
--- a/Zend/tests/bug38942.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #38942 (Double old-style-ctor inheritance)
---FILE--
-<?php
-class foo {
- public function foo() {}
-}
-
-class bar extends foo {
-}
-print_r(get_class_methods("bar"));
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
-Array
-(
- [0] => foo
-)
diff --git a/Zend/tests/bug39003.phpt b/Zend/tests/bug39003.phpt
index dc1c69e8c7..791e11b614 100644
--- a/Zend/tests/bug39003.phpt
+++ b/Zend/tests/bug39003.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39003 (__autoload() is called for type hinting)
+Bug #39003 (autoloader is called for type hinting)
--FILE--
<?php
diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt
index a00e1fb819..43198b5c85 100644
--- a/Zend/tests/bug39018.phpt
+++ b/Zend/tests/bug39018.phpt
@@ -62,44 +62,44 @@ print "\nDone\n";
?>
--EXPECTF--
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %s in %s on line 6
+Warning: Uninitialized string offset: %s in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line %d
+Warning: Uninitialized string offset: %i in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line %d
+Warning: Uninitialized string offset: %i in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line %d
+Warning: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line %d
+Warning: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
b
Done
diff --git a/Zend/tests/bug39036.phpt b/Zend/tests/bug39036.phpt
index 419810eaa1..0cdd75150d 100644
--- a/Zend/tests/bug39036.phpt
+++ b/Zend/tests/bug39036.phpt
@@ -14,6 +14,6 @@ var_dump($key);
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: key in %s on line %d
+Warning: Undefined variable: key in %s on line %d
NULL
Done
diff --git a/Zend/tests/bug39127.phpt b/Zend/tests/bug39127.phpt
deleted file mode 100644
index 31fb6d27d5..0000000000
--- a/Zend/tests/bug39127.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #39127 (Old-style constructor fallbacks produce strange results)
---FILE--
-<?php
-
-class a { function a() { var_dump("a::a() called"); } }
-class b extends a {}
-
-$b = new b;
-var_dump(is_callable(array($b,"a")));
-var_dump(is_callable(array($b,"b")));
-var_dump(is_callable(array($b,"__construct")));
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
-string(13) "a::a() called"
-bool(true)
-bool(false)
-bool(false)
-Done
diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt
index 4394cae1d4..dc31073eb9 100644
--- a/Zend/tests/bug39304.phpt
+++ b/Zend/tests/bug39304.phpt
@@ -7,6 +7,6 @@ Bug #39304 (Segmentation fault with list unpacking of string offset)
var_dump($a,$b);
?>
--EXPECTF--
-Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
NULL
NULL
diff --git a/Zend/tests/bug40236.phpt b/Zend/tests/bug40236.phpt
index 81cd56f71f..204b117099 100644
--- a/Zend/tests/bug40236.phpt
+++ b/Zend/tests/bug40236.phpt
@@ -2,7 +2,6 @@
Bug #40236 (php -a function allocation eats memory)
--SKIPIF--
<?php
-if (php_sapi_name() != "cli") die("skip CLI only");
if (extension_loaded("readline")) die("skip Test doesn't support readline");
?>
--FILE--
diff --git a/Zend/tests/bug40621.phpt b/Zend/tests/bug40621.phpt
index b56a28e58b..8650fd56fa 100644
--- a/Zend/tests/bug40621.phpt
+++ b/Zend/tests/bug40621.phpt
@@ -15,10 +15,7 @@ Foo::get();
echo "Done\n";
?>
--EXPECTF--
-Deprecated: Non-static method Foo::get() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Non-static method Foo::__construct() cannot be called statically in %s:%d
+Fatal error: Uncaught Error: Non-static method Foo::get() cannot be called statically in %s:%d
Stack trace:
-#0 %s(%d): Foo::get()
-#1 {main}
+#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug40784.phpt b/Zend/tests/bug40784.phpt
deleted file mode 100644
index ac2b2331b2..0000000000
--- a/Zend/tests/bug40784.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Bug #40784 (Case sensivity in constructor's fallback)
---FILE--
-<?php
-
-class A {
- function A () { echo "I'm A\n"; }
-}
-
-class B extends A {
- function __construct() {
- parent::__construct();
- parent::__constrUct();
- }
-}
-
-$b = new B;
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-I'm A
-I'm A
-Done
diff --git a/Zend/tests/bug41075.phpt b/Zend/tests/bug41075.phpt
deleted file mode 100644
index 03cf3a42f3..0000000000
--- a/Zend/tests/bug41075.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Bug #41075 (memleak when creating default object caused exception)
---FILE--
-<?php
-
-function err($errno, $errstr, $errfile, $errline)
-{
- throw new Exception($errstr);
-}
-
-set_error_handler("err");
-
-class test {
- function foo() {
- $var = $this->blah->prop = "string";
- var_dump($this->blah);
- }
-}
-
-$t = new test;
-try {
- $t->foo();
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-echo "Done\n";
-?>
---EXPECT--
-string(40) "Creating default object from empty value"
-Done
diff --git a/Zend/tests/bug41209.phpt b/Zend/tests/bug41209.phpt
index 3924f99ac8..da9f57163d 100644
--- a/Zend/tests/bug41209.phpt
+++ b/Zend/tests/bug41209.phpt
@@ -41,6 +41,6 @@ echo "Done\n";
--EXPECTF--
Fatal error: Uncaught ErrorException: Undefined variable: id in %s:%d
Stack trace:
-#0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array)
+#0 %s(%d): env::errorHandler(2, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt
index 2ab26ca4b9..fa14b162d4 100644
--- a/Zend/tests/bug43201.phpt
+++ b/Zend/tests/bug43201.phpt
@@ -26,29 +26,29 @@ Notice: Indirect modification of overloaded property Foo::$arr has no effect in
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 14
-Notice: Undefined variable: ref in %sbug43201.php on line 14
+Warning: Undefined variable: ref in %s on line %d
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
-Notice: Undefined variable: undef in %sbug43201.php on line 16
+Warning: Undefined variable: undef in %s on line %d
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
ok
diff --git a/Zend/tests/bug43323.phpt b/Zend/tests/bug43323.phpt
deleted file mode 100644
index 74abe766e5..0000000000
--- a/Zend/tests/bug43323.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Bug #43323 (Wrong count abstract methods)
---FILE--
-<?php
-abstract class bar {
- abstract public function bar();
-}
-
-class foo extends bar {
-}
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bar has a deprecated constructor in %s on line %d
-
-Fatal error: Class foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (bar::bar) in %sbug43323.php on line 7
diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt
index 4635240699..28af70dc67 100644
--- a/Zend/tests/bug43344_1.phpt
+++ b/Zend/tests/bug43344_1.phpt
@@ -3,6 +3,8 @@ Bug #43344.1 (Wrong error message for undefined namespace constant)
--FILE--
<?php
namespace Foo;
+use Error;
+
function f1($a=bar) {
return $a;
}
@@ -13,20 +15,31 @@ function f3($a=array(bar=>0)) {
reset($a);
return key($a);
}
-echo bar."\n";
-echo f1()."\n";
-echo f2()."\n";
-echo f3()."\n";
-?>
---EXPECTF--
-Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 13
-bar
-Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 3
-bar
-
-Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 6
-bar
+try {
+ echo bar."\n";
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ echo f1()."\n";
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ echo f2()."\n";
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ echo f3()."\n";
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 9
-bar
+?>
+--EXPECT--
+Undefined constant 'Foo\bar'
+Undefined constant 'Foo\bar'
+Undefined constant 'Foo\bar'
+Undefined constant 'Foo\bar'
diff --git a/Zend/tests/bug44660.phpt b/Zend/tests/bug44660.phpt
index 980c2274cd..fbe4a90dcd 100644
--- a/Zend/tests/bug44660.phpt
+++ b/Zend/tests/bug44660.phpt
@@ -8,42 +8,62 @@ $a = true;
echo "--> read access: ";
echo $a->p;
-echo "\n--> direct assignment: ";
-$a->p = $s;
+echo "\n--> direct assignment:\n";
+try {
+ $a->p = $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> increment: ";
-$a->p++;
+echo "\n--> increment:\n";
+try {
+ $a->p++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> reference assignment:";
-$a->p =& $s;
+echo "\n--> reference assignment:\n";
+try {
+ $a->p =& $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> reference assignment:";
-$s =& $a->p;
+echo "\n--> reference assignment:\n";
+try {
+ $s =& $a->p;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> indexed assignment:";
-$a->p[0] = $s;
+echo "\n--> indexed assignment:\n";
+try {
+ $a->p[0] = $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Confirm assignments have had no impact:\n";
var_dump($a);
?>
--EXPECTF--
--> read access:
-Notice: Trying to get property 'p' of non-object in %sbug44660.php on line 6
+Warning: Trying to get property 'p' of non-object in %s on line %d
---> direct assignment:
-Warning: Attempt to assign property 'p' of non-object in %sbug44660.php on line 9
+--> direct assignment:
+Attempt to assign property 'p' of non-object
---> increment:
-Warning: Attempt to increment/decrement property 'p' of non-object in %sbug44660.php on line 12
+--> increment:
+Attempt to increment/decrement property 'p' of non-object
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 15
+Attempt to modify property 'p' of non-object
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 18
+Attempt to modify property 'p' of non-object
--> indexed assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 21
+Attempt to modify property 'p' of non-object
--> Confirm assignments have had no impact:
bool(true)
diff --git a/Zend/tests/bug44899.phpt b/Zend/tests/bug44899.phpt
index d62033a24e..d9c0de0ef7 100644
--- a/Zend/tests/bug44899.phpt
+++ b/Zend/tests/bug44899.phpt
@@ -34,5 +34,5 @@ echo "\n";
isset
empty
-Notice: Undefined property: myclass::$foo in %s on line %d
+Warning: Undefined property: myclass::$foo in %s on line %d
empty
diff --git a/Zend/tests/bug45186.phpt b/Zend/tests/bug45186.phpt
index 411c2ea072..1c25a86921 100644
--- a/Zend/tests/bug45186.phpt
+++ b/Zend/tests/bug45186.phpt
@@ -31,10 +31,14 @@ $x->test();
call_user_func(array('BAR','x'));
call_user_func('BAR::www');
-call_user_func('self::y');
+try {
+ call_user_func('self::y');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
__call:
string(3) "ABC"
__call:
@@ -50,5 +54,4 @@ string(1) "y"
ok
__callstatic:
string(3) "www"
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186.php on line 31
+call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active
diff --git a/Zend/tests/bug45186_2.phpt b/Zend/tests/bug45186_2.phpt
index 7c813a909c..cb098136a0 100644
--- a/Zend/tests/bug45186_2.phpt
+++ b/Zend/tests/bug45186_2.phpt
@@ -26,11 +26,19 @@ $x = new bar;
$x->test();
call_user_func(array('BAR','x'));
-call_user_func('BAR::www');
-call_user_func('self::y');
+try {
+ call_user_func('BAR::www');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func('self::y');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
__call:
string(3) "ABC"
__call:
@@ -44,7 +52,5 @@ string(1) "y"
__call:
string(1) "y"
ok
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www' in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186_2.php on line 27
+call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www'
+call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active
diff --git a/Zend/tests/bug45805.phpt b/Zend/tests/bug45805.phpt
index d63e658868..86cea70373 100644
--- a/Zend/tests/bug45805.phpt
+++ b/Zend/tests/bug45805.phpt
@@ -38,7 +38,7 @@ $o->bar();
--EXPECTF--
Fatal error: Uncaught RuntimeException in %sbug45805.php:%d
Stack trace:
-#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(8, 'Only variables ...', '%s', %d, Array)
+#0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(8, 'Only variables ...', '%s', %d)
#1 [internal function]: B->foo()
#2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B))
#3 %sbug45805.php(%d): B->bar()
diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt
index f18c25a6c2..b0e769e05a 100644
--- a/Zend/tests/bug46106.phpt
+++ b/Zend/tests/bug46106.phpt
@@ -15,8 +15,13 @@ function test($x) {
}
$x = new ReflectionFunction('str_pad');
-test($x);
+try {
+ test($x);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
DONE
--EXPECT--
+str_pad() expects at least 2 parameters, 1 given
DONE
diff --git a/Zend/tests/bug46304.phpt b/Zend/tests/bug46304.phpt
index 9898838907..f8b9a0b525 100644
--- a/Zend/tests/bug46304.phpt
+++ b/Zend/tests/bug46304.phpt
@@ -6,9 +6,6 @@ Bug #46304 (defining namespaced constant using define())
define('NS1\ns2\const1','value1');
define('ns1\ns2\const2','value2');
define('ns1\NS2\coNSt3','value3');
-define('NS1\ns2\const4','value4', true);
-define('ns1\ns2\const5','value5', true);
-define('ns1\NS2\coNSt6','value6', true);
print NS1\ns2\const1 . "\n";
print ns1\ns2\const1 . "\n";
@@ -22,29 +19,9 @@ print NS1\ns2\coNSt3 . "\n";
print ns1\ns2\coNSt3 . "\n";
print ns1\ns2\coNSt3 . "\n";
-print NS1\ns2\const4 . "\n";
-print ns1\ns2\const4 . "\n";
-print ns1\NS2\const4 . "\n";
-print ns1\ns2\coNSt4 . "\n";
-
-print NS1\ns2\const5 . "\n";
-print ns1\ns2\const5 . "\n";
-print ns1\NS2\const5 . "\n";
-print ns1\ns2\coNSt5 . "\n";
-
-print NS1\ns2\const6 . "\n";
-print ns1\ns2\const6 . "\n";
-print ns1\NS2\const6 . "\n";
-print ns1\ns2\coNSt6 . "\n";
-
print NS1\ns2\coNSt1 . "\n";
?>
--EXPECTF--
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 6
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 7
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 8
value1
value1
value1
@@ -54,28 +31,6 @@ value2
value3
value3
value3
-value4
-value4
-value4
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS1\ns2\const4" in %s on line 25
-value4
-value5
-value5
-value5
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\ns2\const5" in %s on line 30
-value5
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 32
-value6
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 33
-value6
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 34
-value6
-value6
Fatal error: Uncaught Error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php:%d
Stack trace:
diff --git a/Zend/tests/bug47054.phpt b/Zend/tests/bug47054.phpt
index 9e89c2c208..f607365bdc 100644
--- a/Zend/tests/bug47054.phpt
+++ b/Zend/tests/bug47054.phpt
@@ -24,8 +24,6 @@ $c->s();
get_called_class();
-D::m();
-
?>
--EXPECTF--
Called class: D
@@ -33,11 +31,3 @@ Called class: C
Called class: C
Warning: get_called_class() called from outside a class in %s on line %d
-
-Deprecated: Non-static method D::m() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
-Stack trace:
-#0 %s(%d): D::m()
-#1 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/bug47109.phpt b/Zend/tests/bug47109.phpt
index 0b86a2bcd3..4f8f4b9328 100644
--- a/Zend/tests/bug47109.phpt
+++ b/Zend/tests/bug47109.phpt
@@ -5,6 +5,6 @@ Bug #47109 (Memory leak on $a->{"a"."b"} when $a is not an object)
$a->{"a"."b"};
?>
--EXPECTF--
-Notice: Undefined variable: a in %sbug47109.php on line 2
+Warning: Undefined variable: a in %s on line %d
-Notice: Trying to get property 'ab' of non-object in %sbug47109.php on line 2
+Warning: Trying to get property 'ab' of non-object in %s on line %d
diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt
deleted file mode 100644
index 47db35edac..0000000000
--- a/Zend/tests/bug47320.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #47320 ($php_errormsg out of scope in functions)
---INI--
-display_errors=0
-track_errors=1
---FILE--
-<?php
-if (!@substr('no 2nd parameter')) {
- echo '$php_errormsg in global: ' . $php_errormsg . "\n";
-}
-
-function foo() {
- if (!@strpos('no 2nd parameter')) {
- echo '$php_errormsg in function: ' . $php_errormsg . "\n";
-
- echo '$GLOBALS[php_errormsg] in function: ' .
- $GLOBALS['php_errormsg'] . "\n";
- }
-}
-
-foo();
-?>
---EXPECT--
-$php_errormsg in global: substr() expects at least 2 parameters, 1 given
-$php_errormsg in function: strpos() expects at least 2 parameters, 1 given
-$GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given
diff --git a/Zend/tests/bug47572.phpt b/Zend/tests/bug47572.phpt
index 67bb3ec111..7a44cc6e7f 100644
--- a/Zend/tests/bug47572.phpt
+++ b/Zend/tests/bug47572.phpt
@@ -14,4 +14,7 @@ $foo = new Foo();
?>
--EXPECTF--
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in %s on line %d
+Fatal error: Uncaught Error: Undefined constant 'FOO' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug47836.phpt b/Zend/tests/bug47836.phpt
index 5a93a44c71..15afc68c48 100644
--- a/Zend/tests/bug47836.phpt
+++ b/Zend/tests/bug47836.phpt
@@ -4,12 +4,16 @@ Bug #47836 (array operator [] inconsistency when the array has PHP_INT_MAX index
<?php
$arr[PHP_INT_MAX] = 1;
-$arr[] = 2;
+try {
+ $arr[] = 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($arr);
?>
--EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line 4
+Cannot add element to the array as the next element is already occupied
array(1) {
[%d]=>
int(1)
diff --git a/Zend/tests/bug47981.phpt b/Zend/tests/bug47981.phpt
deleted file mode 100644
index fba320bb13..0000000000
--- a/Zend/tests/bug47981.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #47981 (error handler not called regardless)
---INI--
-error_reporting=0
---FILE--
-<?php
-function errh($errno, $errstr) {
- var_dump($errstr);
-}
-set_error_handler("errh");
-
-interface a{}
-class b implements a { function f($a=1) {}}
-class c extends b {function f() {}}
-?>
---EXPECT--
-string(60) "Declaration of c::f() should be compatible with b::f($a = 1)"
diff --git a/Zend/tests/bug48004.phpt b/Zend/tests/bug48004.phpt
deleted file mode 100644
index 5968876520..0000000000
--- a/Zend/tests/bug48004.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #48004 (Error handler prevents creation of default object)
---FILE--
-<?php
-function error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
- return true;
-}
-
-function test() {
- $data->id = 1;
- print_r($data);
-}
-
-set_error_handler("error_handler");
-test();
-?>
---EXPECT--
-stdClass Object
-(
- [id] => 1
-)
diff --git a/Zend/tests/bug48533.phpt b/Zend/tests/bug48533.phpt
index 4fa49a2f22..3dfbc658ec 100644
--- a/Zend/tests/bug48533.phpt
+++ b/Zend/tests/bug48533.phpt
@@ -26,8 +26,8 @@ $x->a();
$x->b();
$x->c();
$x::a();
-$x::b();
$x::c();
+$x::b();
?>
--EXPECTF--
@@ -35,7 +35,9 @@ string(9) "__call::a"
int(2)
string(9) "__call::c"
string(15) "__callStatic::a"
-
-Deprecated: Non-static method foo::b() should not be called statically in %s on line %d
-int(2)
string(15) "__callStatic::c"
+
+Fatal error: Uncaught Error: Non-static method foo::b() cannot be called statically in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug48693.phpt b/Zend/tests/bug48693.phpt
deleted file mode 100644
index f916b6407b..0000000000
--- a/Zend/tests/bug48693.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted)
---FILE--
-<?php
-
-try {
- $x = create_function('', 'return 1; }');
-} catch (ParseError $e) {
- echo "$e\n\n";
-}
-try {
- $y = create_function('', 'function a() { }; return 2;');
-} catch (ParseError $e) {
- echo "$e\n\n";
-}
-try {
- $z = create_function('', '{');
-} catch (ParseError $e) {
- echo "$e\n\n";
-}
-try {
- $w = create_function('', 'return 3;');
-} catch (ParseError $e) {
- echo "$e\n\n";
-}
-
-var_dump(
- $y(),
- $w()
-);
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1
-Stack trace:
-#0 %sbug48693.php(4): create_function('', 'return 1; }')
-#1 {main}
-
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1
-Stack trace:
-#0 %sbug48693.php(14): create_function('', '{')
-#1 {main}
-
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(2)
-int(3)
diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt
index e3e91d3452..8ab6307180 100644
--- a/Zend/tests/bug49908.phpt
+++ b/Zend/tests/bug49908.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #49908 (throwing exception in __autoload crashes when interface is not defined)
+Bug #49908 (throwing exception in autoloader crashes when interface is not defined)
--FILE--
<?php
diff --git a/Zend/tests/bug50261.phpt b/Zend/tests/bug50261.phpt
deleted file mode 100644
index 321e9cfb8b..0000000000
--- a/Zend/tests/bug50261.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-Bug #50261 (Crash When Calling Parent Constructor with call_user_func())
---FILE--
-<?php
-
-class testClass {
- function testClass($x) {
- echo __METHOD__, " (". $x . ")\n";
- }
-}
-
-class testClass2 extends testClass {
- function __construct() {
- static $x = 0;
-
- if ($x) {
- print "Infinite loop...\n";
- } else {
- $x++;
-
- parent::__construct(1);
- testclass::__construct(2);
- call_user_func(array('parent', '__construct'), 3);
- call_user_func(array('testclass', '__construct'), 4);
- call_user_func(array('testclass', 'testclass'), 5);
- }
- }
-}
-
-new testClass2;
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; testClass has a deprecated constructor in %s on line %d
-testClass::testClass (1)
-testClass::testClass (2)
-testClass::testClass (3)
-testClass::testClass (4)
-testClass::testClass (5)
diff --git a/Zend/tests/bug51394.phpt b/Zend/tests/bug51394.phpt
index e2d260b2b2..e31bc230cd 100644
--- a/Zend/tests/bug51394.phpt
+++ b/Zend/tests/bug51394.phpt
@@ -15,6 +15,6 @@ $a = $empty($b);
--EXPECTF--
Fatal error: Uncaught Exception: error! in %sbug51394.php:%d
Stack trace:
-#0 %sbug51394.php(%d): eh(8, 'Undefined varia%s', '%s', %d, Array)
+#0 %s(%d): eh(2, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %sbug51394.php on line %d
diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt
index 0834749454..77bdc069c3 100644
--- a/Zend/tests/bug51827.phpt
+++ b/Zend/tests/bug51827.phpt
@@ -16,4 +16,8 @@ register_shutdown_function('exploDe');
--EXPECTF--
int(1)
-Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d
+Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0
+Stack trace:
+#0 [internal function]: explode()
+#1 {main}
+ thrown in [no active file] on line 0
diff --git a/Zend/tests/bug52001.phpt b/Zend/tests/bug52001.phpt
index cf55d195b9..36170eb96b 100644
--- a/Zend/tests/bug52001.phpt
+++ b/Zend/tests/bug52001.phpt
@@ -11,7 +11,7 @@ var_dump($temp1);
function a($b,$c) {}
?>
--EXPECTF--
-Notice: Undefined variable: var in %sbug52001.php on line 2
+Warning: Undefined variable: var in %s on line %d
-Notice: Undefined variable: in %sbug52001.php on line 2
+Warning: Undefined variable: in %s on line %d
int(1)
diff --git a/Zend/tests/bug52041.phpt b/Zend/tests/bug52041.phpt
index a1eb1f841b..467a29fe77 100644
--- a/Zend/tests/bug52041.phpt
+++ b/Zend/tests/bug52041.phpt
@@ -6,12 +6,36 @@ function foo() {
return $x;
}
-foo()->a = 1;
-foo()->a->b = 2;
-foo()->a++;
-foo()->a->b++;
-foo()->a += 2;
-foo()->a->b += 2;
+try {
+ foo()->a = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foo()->a->b = 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foo()->a++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foo()->a->b++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foo()->a += 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ foo()->a->b += 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
foo()[0] = 1;
foo()[0][0] = 2;
@@ -23,71 +47,47 @@ foo()[0][0] += 2;
var_dump(foo());
?>
--EXPECTF--
-Notice: Undefined variable: x in %sbug52041.php on line 3
-
-Warning: Creating default object from empty value in %sbug52041.php on line 6
-
-Notice: Undefined variable: x in %sbug52041.php on line 3
-
-Warning: Creating default object from empty value in %sbug52041.php on line 7
-
-Warning: Creating default object from empty value in %sbug52041.php on line 7
-
-Notice: Undefined variable: x in %sbug52041.php on line 3
-
-Warning: Creating default object from empty value in %sbug52041.php on line 8
-
-Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
-
-Notice: Undefined variable: x in %sbug52041.php on line 3
-
-Warning: Creating default object from empty value in %sbug52041.php on line 9
-
-Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
-
-Warning: Creating default object from empty value in %sbug52041.php on line 9
-
-Notice: Undefined property: stdClass::$b in %sbug52041.php on line 9
-
-Notice: Undefined variable: x in %sbug52041.php on line 3
-
-Warning: Creating default object from empty value in %sbug52041.php on line 10
-
-Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
+Warning: Undefined variable: x in %s on line %d
+Attempt to assign property 'a' of non-object
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
-Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to assign property 'a' of non-object
-Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 15
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 16
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 16
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 17
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 18
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 18
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
NULL
diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt
deleted file mode 100644
index acfddbc36d..0000000000
--- a/Zend/tests/bug52051.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #52051 (handling of case sensitivity of old-style constructors changed in 5.3+)
---FILE--
-<?php
-
-class AA {
- function AA() { echo "foo\n"; }
-}
-class bb extends AA {}
-class CC extends bb {
- function CC() { parent::bb(); }
-}
-new CC();
-
-class A {
- function A() { echo "bar\n"; }
-}
-class B extends A {}
-class C extends B {
- function C() { parent::B(); }
-}
-new C();
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AA has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CC has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
-foo
-bar
diff --git a/Zend/tests/bug52160.phpt b/Zend/tests/bug52160.phpt
deleted file mode 100644
index f0a57000e0..0000000000
--- a/Zend/tests/bug52160.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #52160 (Invalid E_DEPRECATED redefined constructor error)
---FILE--
-<?php
-
-class bar {
- function __construct() { }
- static function bar() {
- var_dump(1);
- }
-}
-
-bar::bar();
-
-class foo {
- static function foo() {
- var_dump(2);
- }
- function __construct() { }
-}
-
-foo::foo();
-
-class baz {
- static function baz() {
- var_dump(3);
- }
-}
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; baz has a deprecated constructor in %s on line %d
-
-Fatal error: Constructor baz::baz() cannot be static in %s on line %d
diff --git a/Zend/tests/bug52237.phpt b/Zend/tests/bug52237.phpt
deleted file mode 100644
index 44f8f3f688..0000000000
--- a/Zend/tests/bug52237.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Bug #52237 (Crash when passing the reference of the property of a non-object)
---FILE--
-<?php
-$data = 'test';
-preg_match('//', '', $data->info);
-var_dump($data);
-?>
---EXPECTF--
-Warning: Attempt to modify property 'info' of non-object in %sbug52237.php on line 3
-string(4) "test"
diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt
index 0a1dca6882..77a5f30f67 100644
--- a/Zend/tests/bug52614.phpt
+++ b/Zend/tests/bug52614.phpt
@@ -52,7 +52,11 @@ var_dump($foo->a2);
$foo->f3()[0] = 1;
var_dump($foo->a3);
-$foo->f4()->a = 1;
+try {
+ $foo->f4()->a = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($foo->o1);
$foo->f5()->a = 1;
@@ -65,16 +69,15 @@ $foo->f1()[0]++;
var_dump($foo->a1[0]);
$foo->f6()[0]++;
var_dump($foo->a1[0]);
---EXPECTF--
+--EXPECT--
NULL
array(0) {
}
array(0) {
}
-
-Warning: Creating default object from empty value in %sbug52614.php on line 52
+Attempt to assign property 'a' of non-object
NULL
-object(stdClass)#%d (1) {
+object(stdClass)#3 (1) {
["a"]=>
int(1)
}
diff --git a/Zend/tests/bug54262.phpt b/Zend/tests/bug54262.phpt
deleted file mode 100644
index 16933ca300..0000000000
--- a/Zend/tests/bug54262.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #54262 (Crash when assigning value to a dimension in a non-array)
---FILE--
-<?php
-$a = '0';
-var_dump(isset($a['b']));
-$simpleString = preg_match('//', '', $a->a);
-$simpleString["wrong"] = "f";
-echo "ok\n";
-?>
---EXPECTF--
-bool(false)
-
-Warning: Attempt to modify property 'a' of non-object in %sbug54262.php on line 4
-
-Warning: Cannot use a scalar value as an array in %sbug54262.php on line 5
-ok
diff --git a/Zend/tests/bug54265.phpt b/Zend/tests/bug54265.phpt
deleted file mode 100644
index 417e1b5564..0000000000
--- a/Zend/tests/bug54265.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Bug #54265 (crash when variable gets reassigned in error handler)
---FILE--
-<?php
-function my_errorhandler($errno,$errormsg) {
- global $my_var;
- $my_var = 0;
- echo "EROOR: $errormsg\n";
-}
-set_error_handler("my_errorhandler");
-$my_var = str_repeat("A",$my_var[0]->errormsg = "xyz");
-echo "ok\n";
-?>
---EXPECT--
-EROOR: Creating default object from empty value
-ok
diff --git a/Zend/tests/bug54585.phpt b/Zend/tests/bug54585.phpt
deleted file mode 100644
index deabe55af8..0000000000
--- a/Zend/tests/bug54585.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #54585 (track_errors causes segfault)
---INI--
-track_errors=On
---FILE--
-<?php
-function testing($source) {
- unset($source[$cos]);
-}
-testing($_GET);
-echo "ok\n";
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: cos in %sbug54585.php on line 3
-ok
diff --git a/Zend/tests/bug60536_001.phpt b/Zend/tests/bug60536_001.phpt
index 0847b81d40..b4630f4b87 100644
--- a/Zend/tests/bug60536_001.phpt
+++ b/Zend/tests/bug60536_001.phpt
@@ -22,5 +22,5 @@ $a->__construct();
echo "DONE";
?>
--EXPECTF--
-Notice: Undefined property: Z::$x in %s on line 14
+Warning: Undefined property: Z::$x in %s on line %d
DONE
diff --git a/Zend/tests/bug60573.phpt b/Zend/tests/bug60573.phpt
index 871be56a16..50650f5419 100644
--- a/Zend/tests/bug60573.phpt
+++ b/Zend/tests/bug60573.phpt
@@ -53,32 +53,6 @@ public function setSelf(self $s) { }
}
-class Foo5 extends Base {
-
-public function setSelf(parent $s) { }
-
-}
-
-class Bar5 extends Foo5 {
-
-public function setSelf(parent $s) { }
-
-}
-
-abstract class Foo6 extends Base {
-
-abstract public function setSelf(parent $s);
-
-}
-
-class Bar6 extends Foo6 {
-
-public function setSelf(Foo6 $s) { }
-
-}
+?>
--EXPECTF--
-Warning: Declaration of Bar4::setSelf(Bar4 $s) should be compatible with Foo4::setSelf(Foo4 $s) in %sbug60573.php on line %d
-
-Warning: Declaration of Bar5::setSelf(Foo5 $s) should be compatible with Foo5::setSelf(Base $s) in %sbug60573.php on line %d
-
-Fatal error: Declaration of Bar6::setSelf(Foo6 $s) must be compatible with Foo6::setSelf(Base $s) in %sbug60573.php on line %d
+Fatal error: Declaration of Bar4::setSelf(Bar4 $s) must be compatible with Foo4::setSelf(Foo4 $s) in %s on line %d
diff --git a/Zend/tests/bug60573_2.phpt b/Zend/tests/bug60573_2.phpt
new file mode 100644
index 0000000000..221745316a
--- /dev/null
+++ b/Zend/tests/bug60573_2.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Bug #60573 (type hinting with "self" keyword causes weird errors) -- variation 2
+--FILE--
+<?php
+class Foo1 {
+
+public function setSelf(self $s) { }
+
+}
+
+class Bar1 extends Foo1 {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Foo2 {
+
+public function setSelf(Foo2 $s) { }
+
+}
+
+class Bar2 extends Foo2 {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Base {
+}
+
+class Foo3 extends Base{
+
+public function setSelf(parent $s) { }
+
+}
+
+class Bar3 extends Foo3 {
+
+public function setSelf(Base $s) { }
+
+}
+
+class Foo4 {
+
+public function setSelf(self $s) { }
+
+}
+
+class Foo5 extends Base {
+
+public function setSelf(parent $s) { }
+
+}
+
+class Bar5 extends Foo5 {
+
+public function setSelf(parent $s) { }
+
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar5::setSelf(Foo5 $s) must be compatible with Foo5::setSelf(Base $s) in %sbug60573_2.php on line %d
diff --git a/Zend/tests/bug60909_1.phpt b/Zend/tests/bug60909_1.phpt
index e4c07face1..d674490302 100644
--- a/Zend/tests/bug60909_1.phpt
+++ b/Zend/tests/bug60909_1.phpt
@@ -13,7 +13,7 @@ require 'notfound.php';
error(require(notfound.php): failed to open stream: %s)
Warning: Uncaught Exception: Foo in %sbug60909_1.php:5
Stack trace:
-#0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8, Array)
+#0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8)
#1 %sbug60909_1.php(8): require()
#2 {main}
thrown in %sbug60909_1.php on line 5
diff --git a/Zend/tests/bug60978.phpt b/Zend/tests/bug60978.phpt
index 676808c7a3..5dc6fe31e7 100644
--- a/Zend/tests/bug60978.phpt
+++ b/Zend/tests/bug60978.phpt
@@ -1,11 +1,5 @@
--TEST--
Bug #60978 (exit code incorrect)
---SKIPIF--
-<?php
- if ("cli" != php_sapi_name()) {
- echo "skip CLI only";
- }
-?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
diff --git a/Zend/tests/bug61011.phpt b/Zend/tests/bug61011.phpt
index dc0aca64f8..b9088c68f1 100644
--- a/Zend/tests/bug61011.phpt
+++ b/Zend/tests/bug61011.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property)
+Bug #61011 (Crash when an exception is thrown by autoloader accessing a static property)
--FILE--
<?php
spl_autoload_register(function ($name) {
diff --git a/Zend/tests/bug61095.phpt b/Zend/tests/bug61095.phpt
index 4ca196cd15..ce5426ca65 100644
--- a/Zend/tests/bug61095.phpt
+++ b/Zend/tests/bug61095.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #61095 (Lexing 0x00*+<NUM> incorectly)
+Bug #61095 (Lexing 0x00*+<NUM> incorrectly)
--FILE--
<?php
echo 0x00+2;
diff --git a/Zend/tests/bug61225.phpt b/Zend/tests/bug61225.phpt
index 33d74bd561..6baa00ace2 100644
--- a/Zend/tests/bug61225.phpt
+++ b/Zend/tests/bug61225.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #61225 (Lexing 0b0*+<NUM> incorectly)
+Bug #61225 (Lexing 0b0*+<NUM> incorrectly)
--FILE--
<?php
echo 0b00+1;
diff --git a/Zend/tests/bug61767.phpt b/Zend/tests/bug61767.phpt
index 5e949706e8..3bc1e49d09 100644
--- a/Zend/tests/bug61767.phpt
+++ b/Zend/tests/bug61767.phpt
@@ -19,7 +19,7 @@ Error handler called (Undefined variable: undefined)
Fatal error: Uncaught ErrorException: Undefined variable: undefined in %sbug61767.php:%d
Stack trace:
-#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d, Array)
+#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %sbug61767.php on line %d
Shutting down
diff --git a/Zend/tests/bug62005.phpt b/Zend/tests/bug62005.phpt
deleted file mode 100644
index 83158d5cc2..0000000000
--- a/Zend/tests/bug62005.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
---FILE--
-<?php
-function add_points($player, $points) {
- $player->energy += $points;
- print_r($player);
-}
-add_points(NULL, 2);
---EXPECTF--
-Warning: Creating default object from empty value in %sbug62005.php on line %d
-
-Notice: Undefined property: stdClass::$energy in %sbug62005.php on line 3
-stdClass Object
-(
- [energy] => 2
-)
diff --git a/Zend/tests/bug63336.phpt b/Zend/tests/bug63336.phpt
deleted file mode 100644
index 271d3e82a9..0000000000
--- a/Zend/tests/bug63336.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #63336 (invalid E_NOTICE error occur)
---FILE--
-<?php
-error_reporting(E_ALL & ~E_WARNING);
-define("TEST", "123");
-class Base {
- const DUMMY = "XXX";
- public function foo($var=TEST, $more=null) { return true; }
- public function bar($more=self::DUMMY) { return true; }
-}
-
-class Child extends Base {
- const DUMMY = "DDD";
- public function foo($var=TEST, array $more = array()) { return true; }
- public function bar($var, $more=self::DUMMY) { return true; }
-}
-?>
---EXPECTF--
-Warning: Declaration of Child::foo($var = TEST, array $more = Array) should be compatible with Base::foo($var = TEST, $more = NULL) in %sbug63336.php on line %d
-
-Warning: Declaration of Child::bar($var, $more = self::DUMMY) should be compatible with Base::bar($more = self::DUMMY) in %sbug63336.php on line %d
diff --git a/Zend/tests/bug63462.phpt b/Zend/tests/bug63462.phpt
index 45c9507bba..bcc2c67997 100644
--- a/Zend/tests/bug63462.phpt
+++ b/Zend/tests/bug63462.phpt
@@ -52,16 +52,16 @@ $test->privateProperty = 'value';
--EXPECTF--
__get nonExisting
-Notice: Undefined property: Test::$nonExisting in %s on line %d
+Warning: Undefined property: Test::$nonExisting in %s on line %d
__get publicProperty
-Notice: Undefined property: Test::$publicProperty in %s on line %d
+Warning: Undefined property: Test::$publicProperty in %s on line %d
__get protectedProperty
-Notice: Undefined property: Test::$protectedProperty in %s on line %d
+Warning: Undefined property: Test::$protectedProperty in %s on line %d
__get privateProperty
-Notice: Undefined property: Test::$privateProperty in %s on line %d
+Warning: Undefined property: Test::$privateProperty in %s on line %d
__isset nonExisting
__isset publicProperty
__isset protectedProperty
diff --git a/Zend/tests/bug64960.phpt b/Zend/tests/bug64960.phpt
index 52af0bbe32..4ee4042617 100644
--- a/Zend/tests/bug64960.phpt
+++ b/Zend/tests/bug64960.phpt
@@ -33,7 +33,7 @@ Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete o
Fatal error: Uncaught Exception in %sbug64960.php:19
Stack trace:
-#0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9, Array)
+#0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9)
#1 %sbug64960.php(9): ob_end_clean()
#2 [internal function]: ExceptionHandler->__invoke(Object(Exception))
#3 {main}
diff --git a/Zend/tests/bug64988.phpt b/Zend/tests/bug64988.phpt
index 41d89cc54c..7e2289f5b2 100644
--- a/Zend/tests/bug64988.phpt
+++ b/Zend/tests/bug64988.phpt
@@ -26,5 +26,4 @@ $o = new Smooth1();
echo "okey";
?>
--EXPECTF--
-Warning: Declaration of Smooth1::insert(array $data) should be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 17
-okey
+Fatal error: Declaration of Smooth1::insert(array $data) must be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 17
diff --git a/Zend/tests/bug65322.phpt b/Zend/tests/bug65322.phpt
index 4985ae55d6..2ae2780bb6 100644
--- a/Zend/tests/bug65322.phpt
+++ b/Zend/tests/bug65322.phpt
@@ -15,10 +15,10 @@ set_error_handler(function($_, $msg, $file) {
/* This is just a particular example of a non-fatal compile-time error
* If this breaks in future, just find another example and use it instead */
-eval('class A { function test() { } } class B extends A { function test($a) { } }');
+eval('class A { private function __invoke() { } }');
?>
--EXPECTF--
-string(62) "Declaration of B::test($a) should be compatible with A::test()"
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
string(1) "X"
diff --git a/Zend/tests/bug66218.phpt b/Zend/tests/bug66218.phpt
index d800605ac8..db3c7c655a 100644
--- a/Zend/tests/bug66218.phpt
+++ b/Zend/tests/bug66218.phpt
@@ -2,7 +2,6 @@
Bug #66218 zend_register_functions breaks reflection
--SKIPIF--
<?php
-if (PHP_SAPI != "cli") die("skip CLI only test");
if (!function_exists("dl")) die("skip need dl");
?>
--FILE--
diff --git a/Zend/tests/bug66609.phpt b/Zend/tests/bug66609.phpt
index 206f7757d9..880f5a58a4 100644
--- a/Zend/tests/bug66609.phpt
+++ b/Zend/tests/bug66609.phpt
@@ -24,5 +24,5 @@ $foo->blah--; //crash
echo "okey";
?>
--EXPECTF--
-Notice: Undefined property: Bar::$bar in %sbug66609.php on line %d
+Warning: Undefined property: Bar::$bar in %s on line %d
okey
diff --git a/Zend/tests/bug67314.phpt b/Zend/tests/bug67314.phpt
index c5b6a1293d..3ef225de03 100644
--- a/Zend/tests/bug67314.phpt
+++ b/Zend/tests/bug67314.phpt
@@ -15,8 +15,8 @@ echo "made it once\n";
crash();
echo "ok\n";
--EXPECTF--
-Notice: Undefined variable: i in %sbug67314.php on line 4
+Warning: Undefined variable: i in %s on line %d
made it once
-Notice: Undefined variable: i in %sbug67314.php on line 4
+Warning: Undefined variable: i in %s on line %d
ok
diff --git a/Zend/tests/bug67436/b.inc b/Zend/tests/bug67436/b.inc
index 793a1394d6..bb2521f61f 100644
--- a/Zend/tests/bug67436/b.inc
+++ b/Zend/tests/bug67436/b.inc
@@ -1,7 +1,9 @@
<?php
class b extends a {
- public function test() {
+ private function __invoke() {}
+
+ public function test($arg = c::TESTCONSTANT) {
echo __METHOD__ . "()\n";
parent::test();
}
diff --git a/Zend/tests/bug67436/bug67436.phpt b/Zend/tests/bug67436/bug67436.phpt
index 0ef339dc47..14db266831 100644
--- a/Zend/tests/bug67436/bug67436.phpt
+++ b/Zend/tests/bug67436/bug67436.phpt
@@ -2,6 +2,8 @@
bug67436: Autoloader isn't called if user defined error handler is present
--INI--
error_reporting=-1
+--SKIPIF--
+<?php if (extension_loaded('Zend OPCache')) die('skip Opcache overrides error handler'); ?>
--FILE--
<?php
@@ -12,6 +14,7 @@ spl_autoload_register(function($classname) {
});
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
}, error_reporting());
a::staticTest();
@@ -19,5 +22,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECT--
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index a155ccc842..5394177064 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -14,6 +14,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECTF--
-Warning: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.inc on line %d
+Warning: The magic method __invoke() must have public visibility and cannot be static in %s on line %d
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67858.phpt b/Zend/tests/bug67858.phpt
deleted file mode 100644
index 1186cd6a6f..0000000000
--- a/Zend/tests/bug67858.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #67858: Leak when $php_errormsg already set
---INI--
-track_errors=1
-error_reporting=E_ALL
---FILE--
-<?php
-
-function f() {
- $php_errormsg = [1, 2, 3];
- echo $var;
- var_dump($php_errormsg);
-}
-f();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: var in %s on line %d
-string(23) "Undefined variable: var"
diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt
index 9648966691..91685ebb5e 100644
--- a/Zend/tests/bug68446.phpt
+++ b/Zend/tests/bug68446.phpt
@@ -9,7 +9,7 @@ function a(array $a = FOO) {
var_dump($a);
}
-function b(array $b = BAR) {
+function b(?array $b = BAR) {
var_dump($b);
}
diff --git a/Zend/tests/bug69017.phpt b/Zend/tests/bug69017.phpt
index 762fcbc9a0..d6d20d7c08 100644
--- a/Zend/tests/bug69017.phpt
+++ b/Zend/tests/bug69017.phpt
@@ -16,14 +16,18 @@ class c1
c1::$a1[] = 1;
c1::$a2[] = 1;
-c1::$a3[] = 1;
+try {
+ c1::$a3[] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(c1::$a1);
var_dump(c1::$a2);
var_dump(c1::$a3);
?>
--EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d
+Cannot add element to the array as the next element is already occupied
array(2) {
[1]=>
string(3) "one"
diff --git a/Zend/tests/bug69388.phpt b/Zend/tests/bug69388.phpt
index bf0c0a3c39..3846cca4ca 100644
--- a/Zend/tests/bug69388.phpt
+++ b/Zend/tests/bug69388.phpt
@@ -3,7 +3,7 @@ Bug #69388: Use after free on recursive calls to PHP compiler
--FILE--
<?php
-function handle_error($code, $message, $file, $line, $context) {
+function handle_error($code, $message, $file, $line) {
if (!function_exists("bla")) {
eval('function bla($s) {echo "$s\n";}');
}
diff --git a/Zend/tests/bug69388_2.phpt b/Zend/tests/bug69388_2.phpt
index b55153b492..40b14e0257 100644
--- a/Zend/tests/bug69388_2.phpt
+++ b/Zend/tests/bug69388_2.phpt
@@ -2,7 +2,7 @@
Bug #69388 - Variation
--FILE--
<?php
-function handle_error($code, $message, $file, $line, $context) {
+function handle_error($code, $message, $file, $line) {
eval('namespace Foo;');
echo "$message\n";
}
diff --git a/Zend/tests/bug69732.phpt b/Zend/tests/bug69732.phpt
index f5571627fe..578cb8d143 100644
--- a/Zend/tests/bug69732.phpt
+++ b/Zend/tests/bug69732.phpt
@@ -20,7 +20,7 @@ $wpq->interesting =& ret_assoc();
$x = $wpq->interesting;
printf("%s\n", $x);
--EXPECTF--
-Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
+Warning: Undefined property: wpq::$interesting in %s on line %d
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt
index 08432808e2..e419756d26 100644
--- a/Zend/tests/bug69755.phpt
+++ b/Zend/tests/bug69755.phpt
@@ -5,4 +5,7 @@ Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER
c . 10;
?>
--EXPECTF--
-Warning: Use of undefined constant c - assumed 'c' (this will throw an Error in a future version of PHP) in %sbug69755.php on line 2
+Fatal error: Uncaught Error: Undefined constant 'c' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug69767.phpt b/Zend/tests/bug69767.phpt
index 9458546dea..095bfd89d5 100644
--- a/Zend/tests/bug69767.phpt
+++ b/Zend/tests/bug69767.phpt
@@ -5,4 +5,4 @@ Bug #69767 (Default parameter value with wrong type segfaults)
function foo(String $bar = 0) {}
?>
--EXPECTF--
-Fatal error: Default value for parameters with a string type can only be string or NULL in %sbug69767.php on line %d
+Fatal error: Cannot use int as default value for parameter $bar of type string in %s on line %d
diff --git a/Zend/tests/bug69788.phpt b/Zend/tests/bug69788.phpt
index ff028411b1..e847b3b0a5 100644
--- a/Zend/tests/bug69788.phpt
+++ b/Zend/tests/bug69788.phpt
@@ -3,6 +3,7 @@ Bug #69788: Malformed script causes Uncaught Error in php-cgi, valgrind SIGILL
--FILE--
<?php [t.[]]; ?>
--EXPECTF--
-Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
+Fatal error: Uncaught Error: Undefined constant 't' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug70124.phpt b/Zend/tests/bug70124.phpt
index f32a8613fe..87ec4ab41d 100644
--- a/Zend/tests/bug70124.phpt
+++ b/Zend/tests/bug70124.phpt
@@ -39,7 +39,7 @@ try {
}
?>
--EXPECTF--
-Notice: Undefined variable: f in %sbug70124.php on line %d
+Warning: Undefined variable: f in %s on line %d
string(30) "Function name must be a string"
string(31) "Call to undefined method A::y()"
string(31) "Call to undefined method A::y()"
diff --git a/Zend/tests/bug70681.phpt b/Zend/tests/bug70681.phpt
index 9dd09b07b8..d0cc9523a9 100644
--- a/Zend/tests/bug70681.phpt
+++ b/Zend/tests/bug70681.phpt
@@ -12,5 +12,5 @@ var_dump($c("foo"));
?>
--EXPECTF--
-Warning: Cannot unbind $this of internal method in %s on line %d
+Warning: Cannot unbind $this of method in %s on line %d
int(3)
diff --git a/Zend/tests/bug70895.phpt b/Zend/tests/bug70895.phpt
index 896bf00a7b..71ff19a0b5 100644
--- a/Zend/tests/bug70895.phpt
+++ b/Zend/tests/bug70895.phpt
@@ -3,13 +3,23 @@ Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
-array_map("%n", 0);
-array_map("%n %i", 0);
-array_map("%n %i aoeu %f aoeu %p", 0);
+try {
+ array_map("%n", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map("%n %i", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map("%n %i aoeu %f aoeu %p", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTREGEX--
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n' not found or invalid function name in .+
-
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name in .+
-
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name in .+bug70895.php on line \d+
+--EXPECT--
+array_map() expects parameter 1 to be a valid callback, function '%n' not found or invalid function name
+array_map() expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name
+array_map() expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name
diff --git a/Zend/tests/bug70898.phpt b/Zend/tests/bug70898.phpt
index e31ee894bf..fa6e96d83f 100644
--- a/Zend/tests/bug70898.phpt
+++ b/Zend/tests/bug70898.phpt
@@ -2,21 +2,15 @@
Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
- function m($f,$a){
- return array_map($f,0);
- }
+function m($f,$a){
+ return array_map($f,0);
+}
- echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
+try {
+ echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: implode(): Argument must be an array in %sbug70898.php on line %d
+--EXPECT--
+array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name
diff --git a/Zend/tests/bug70957.phpt b/Zend/tests/bug70957.phpt
index 7db7d7d023..ad2115e4a0 100644
--- a/Zend/tests/bug70957.phpt
+++ b/Zend/tests/bug70957.phpt
@@ -19,4 +19,4 @@ class B extends Foo
}
?>
--EXPECTF--
-Warning: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
+Fatal error: Declaration of T::bar() must be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
diff --git a/Zend/tests/bug71221.phpt b/Zend/tests/bug71221.phpt
index 0f6ee16946..eeba6450ab 100644
--- a/Zend/tests/bug71221.phpt
+++ b/Zend/tests/bug71221.phpt
@@ -3,8 +3,14 @@ Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
--FILE--
<?php
ob_start("get_defined_vars");
-ob_end_clean();
+try {
+ ob_end_clean();
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
-okey
+
+OKAY
--EXPECT--
-okey
+Cannot call get_defined_vars() dynamically
+OKAY
diff --git a/Zend/tests/bug71300.phpt b/Zend/tests/bug71300.phpt
index 3589c4764e..fc4b23681a 100644
--- a/Zend/tests/bug71300.phpt
+++ b/Zend/tests/bug71300.phpt
@@ -24,5 +24,5 @@ var_dump(test2());
--EXPECTF--
string(4) "test"
-Notice: Array to string conversion in %sbug71300.php on line %d
+Warning: Array to string conversion in %s on line %d
string(9) "Arraytest"
diff --git a/Zend/tests/bug71428.1.phpt b/Zend/tests/bug71428.1.phpt
index 490fc30070..acecd85fc5 100644
--- a/Zend/tests/bug71428.1.phpt
+++ b/Zend/tests/bug71428.1.phpt
@@ -9,4 +9,4 @@ class B extends A {
public function m(array $a = []) {}
}
--EXPECTF--
-Warning: Declaration of B::m(array $a = Array) should be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
+Fatal error: Declaration of B::m(array $a = Array) must be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
diff --git a/Zend/tests/bug71428.3.phpt b/Zend/tests/bug71428.3.phpt
index 78fff6e70d..ab3cc9ae16 100644
--- a/Zend/tests/bug71428.3.phpt
+++ b/Zend/tests/bug71428.3.phpt
@@ -7,4 +7,4 @@ class B { public function m(A $a = NULL, $n) { echo "B.m";} };
class C extends B { public function m(A $a , $n) { echo "C.m";} };
?>
--EXPECTF--
-Warning: Declaration of C::m(A $a, $n) should be compatible with B::m(?A $a, $n) in %sbug71428.3.php on line 4
+Fatal error: Declaration of C::m(A $a, $n) must be compatible with B::m(?A $a, $n) in %sbug71428.3.php on line 4
diff --git a/Zend/tests/bug71539_5.phpt b/Zend/tests/bug71539_5.phpt
index 7e89971ec2..bd08de5eb6 100644
--- a/Zend/tests/bug71539_5.phpt
+++ b/Zend/tests/bug71539_5.phpt
@@ -3,18 +3,17 @@ Bug #71539.5 (Memory error on $arr[$a] =& $arr[$b] if RHS rehashes)
--FILE--
<?php
$array = [];
-$array['']->prop =& $array[0];
+$array[''][0] =& $array[0];
$array[0] = 42;
var_dump($array);
?>
---EXPECTF--
-Warning: Creating default object from empty value in %sbug71539_5.php on line 3
+--EXPECT--
array(2) {
[0]=>
&int(42)
[""]=>
- object(stdClass)#1 (1) {
- ["prop"]=>
+ array(1) {
+ [0]=>
&int(42)
}
}
diff --git a/Zend/tests/bug71841.phpt b/Zend/tests/bug71841.phpt
index f66761b3c9..35b805a2a7 100644
--- a/Zend/tests/bug71841.phpt
+++ b/Zend/tests/bug71841.phpt
@@ -1,23 +1,33 @@
--TEST--
Bug #71841 (EG(error_zval) is not handled well)
---INI--
-error_reporting=0
--FILE--
<?php
$z = unserialize('O:1:"A":0:{}');
-var_dump($z->e.=0);
-var_dump(++$z->x);
-var_dump($z->y++);
+@var_dump($z->e.=0);
+@var_dump(++$z->x);
+@var_dump($z->y++);
$y = array(PHP_INT_MAX => 0);
-var_dump($y[] .= 0);
-var_dump(++$y[]);
-var_dump($y[]++);
+try {
+ var_dump($y[] .= 0);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(++$y[]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($y[]++);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECT--
NULL
NULL
NULL
-NULL
-NULL
-NULL
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/bug72057.phpt b/Zend/tests/bug72057.phpt
index 406efe3efc..a518d82948 100644
--- a/Zend/tests/bug72057.phpt
+++ b/Zend/tests/bug72057.phpt
@@ -13,7 +13,7 @@ set_error_handler(
--EXPECTF--
Fatal error: Uncaught Exception: My custom error in %s:%d
Stack trace:
-#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d, Array)
+#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d)
#1 %s(%d): {closure}('7as')
#2 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug72101.phpt b/Zend/tests/bug72101.phpt
index 808627be3b..23861958fd 100644
--- a/Zend/tests/bug72101.phpt
+++ b/Zend/tests/bug72101.phpt
@@ -76,7 +76,7 @@ $foo->bar($a, $b, $c);
--EXPECTF--
Fatal error: Uncaught Error: Class 'DoesNotExists' not found in %sbug72101.php:61
Stack trace:
-#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8, Array)
+#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8)
#1 %sbug72101.php(27): PHPUnit_Framework_MockObject_Stub_ReturnCallback->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
#2 %sbug72101.php(19): PHPUnit_Framework_MockObject_Matcher->invoked(Object(PHPUnit_Framework_MockObject_Invocation_Static))
#3 %sbug72101.php(52): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
diff --git a/Zend/tests/bug72107.phpt b/Zend/tests/bug72107.phpt
index 3f4c46cf70..c22f657ebb 100644
--- a/Zend/tests/bug72107.phpt
+++ b/Zend/tests/bug72107.phpt
@@ -6,9 +6,11 @@ set_error_handler('func_get_args');
function test($a) {
echo $undef;
}
-test(1);
+try {
+ test(1);
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
---EXPECTF--
-Warning: Cannot call func_get_args() dynamically in %s on line %d
-
-Notice: Undefined variable: undef in %s on line %d
+--EXPECT--
+Cannot call func_get_args() dynamically
diff --git a/Zend/tests/bug72911.phpt b/Zend/tests/bug72911.phpt
deleted file mode 100644
index 0d290caca7..0000000000
--- a/Zend/tests/bug72911.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
---FILE--
-<?php
-
-$a = 0;
-
-$b = $a->b->i -= 0;
-
-var_dump($b);
-
-?>
---EXPECTF--
-Warning: Attempt to modify property 'b' of non-object in %sbug72911.php on line %d
-NULL
diff --git a/Zend/tests/bug72944.phpt b/Zend/tests/bug72944.phpt
index 0ee8bd62c6..0ddc99ff3b 100644
--- a/Zend/tests/bug72944.phpt
+++ b/Zend/tests/bug72944.phpt
@@ -2,11 +2,10 @@
Bug #72944 (Null pointer deref in zval_delref_p).
--FILE--
<?php
+define('e', 'e');
("a"== e & $A = $A? 0 : 0) ?:0;
echo "OK\n";
?>
--EXPECTF--
-Warning: Use of undefined constant e - assumed 'e' (this will throw an Error in a future version of PHP) in %sbug72944.php on line 2
-
-Notice: Undefined variable: A in %sbug72944.php on line 2
+Warning: Undefined variable: A in %s on line %d
OK
diff --git a/Zend/tests/bug73163.phpt b/Zend/tests/bug73163.phpt
deleted file mode 100644
index 5c0560458d..0000000000
--- a/Zend/tests/bug73163.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #73163 (PHP hangs if error handler throws while accessing undef const in default value)
---FILE--
-<?php
-
-function doSomething(string $value = UNDEFINED) {
-}
-
-set_error_handler(function($errno, $errstr) {
- throw new Exception($errstr);
-});
-
-doSomething();
-
-?>
---EXPECTF--
-Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s:%d
-Stack trace:
-#0 %s(%d): {closure}(%s)
-#1 %s(%d): doSomething()
-#2 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/bug73181.phpt b/Zend/tests/bug73181.phpt
deleted file mode 100644
index 3ab93ebf5b..0000000000
--- a/Zend/tests/bug73181.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #73181: parse_str() without a second argument leads to crash
---FILE--
-<?php
-
-function x() {
- parse_str("1&x");
- var_dump(get_defined_vars());
-}
-
-x();
-
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-array(2) {
- [1]=>
- string(0) ""
- ["x"]=>
- string(0) ""
-}
diff --git a/Zend/tests/bug73338.phpt b/Zend/tests/bug73338.phpt
index df4c3b66e4..816a526445 100644
--- a/Zend/tests/bug73338.phpt
+++ b/Zend/tests/bug73338.phpt
@@ -14,5 +14,6 @@ try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
?>
---EXPECTF--
-Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug74084.phpt b/Zend/tests/bug74084.phpt
index 2e65471bcc..108f03be36 100644
--- a/Zend/tests/bug74084.phpt
+++ b/Zend/tests/bug74084.phpt
@@ -4,16 +4,31 @@ Bug #74084 (Out of bound read - zend_mm_alloc_small)
error_reporting=0
--FILE--
<?php
-$$A += $$B->a = &$$C;
+$$A += $$B['a'] = &$$C;
unset($$A);
-$$A -= $$B->a = &$$C;
+try {
+ $$A -= $$B['a'] = &$$C;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
unset($$A);
-$$A *= $$B->a = &$$C;
+try {
+ $$A *= $$B['a'] = &$$C;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
unset($$A);
-$$A /= $$B->a = &$$C;
+try {
+ $$A /= $$B['a'] = &$$C;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
unset($$A);
-$$A **= $$B->a = &$$C;
+$$A **= $$B['a'] = &$$C;
var_dump($$A);
?>
--EXPECT--
-int(1)
+Unsupported operand types
+Unsupported operand types
+Unsupported operand types
+int(0)
diff --git a/Zend/tests/bug74340.phpt b/Zend/tests/bug74340.phpt
index f266dcc236..64d1b91b14 100644
--- a/Zend/tests/bug74340.phpt
+++ b/Zend/tests/bug74340.phpt
@@ -24,7 +24,7 @@ $test->test;
--EXPECTF--
__get test
-Notice: Undefined property: Test::$test in %s on line %d
+Warning: Undefined property: Test::$test in %s on line %d
__get test2
-Notice: Undefined property: Test::$test in %s on line %d
+Warning: Undefined property: Test::$test in %s on line %d
diff --git a/Zend/tests/bug74408.phpt b/Zend/tests/bug74408.phpt
deleted file mode 100644
index e770a51dc8..0000000000
--- a/Zend/tests/bug74408.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #74408 (Endless loop bypassing execution time limit)
---FILE--
-<?php
-
- class ErrorHandling {
-
- public function error_handler($errno, $errstr, $errfile, $errline) {
- $bla = new NonExistingClass2();
- }
-
- public function exception_handler(Error $e) {
- echo "Caught, exception: " . $e->getMessage();
- }
- }
-
- set_error_handler('ErrorHandling::error_handler');
- set_exception_handler('ErrorHandling::exception_handler');
-
- $blubb = new NonExistingClass();
-?>
---EXPECTF--
-Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d
-
-Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d
-
-Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in Unknown on line 0
-
-Fatal error: Uncaught Error: Class 'NonExistingClass2' not found in %sbug74408.php:%d
-Stack trace:
-#0 [internal function]: ErrorHandling::error_handler(8192, 'Non-static meth...', '%s', %d, Array)
-#1 %sbug74408.php(%d): set_exception_handler('ErrorHandling::...')
-#2 {main}
- thrown in %sbug74408.php on line %d
diff --git a/Zend/tests/bug75241.phpt b/Zend/tests/bug75241.phpt
index 1751bbee76..d6c2d79e2d 100644
--- a/Zend/tests/bug75241.phpt
+++ b/Zend/tests/bug75241.phpt
@@ -2,12 +2,12 @@
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
--FILE--
<?php
-function eh(){}
-
-set_error_handler('eh');
$d->d = &$d + $d->d/=0;
var_dump($d);
?>
---EXPECT--
-float(INF)
+--EXPECTF--
+Fatal error: Uncaught Error: Attempt to modify property 'd' of non-object in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug75573.phpt b/Zend/tests/bug75573.phpt
index f5e87f8283..867f5d597f 100644
--- a/Zend/tests/bug75573.phpt
+++ b/Zend/tests/bug75573.phpt
@@ -6,6 +6,10 @@ Bug #75573 (Segmentation fault in 7.1.12 and 7.0.26)
class A
{
var $_stdObject;
+ function __construct()
+ {
+ $this->_stdObject = new stdClass;
+ }
function &__get($property)
{
if (isset($this->_stdObject->{$property})) {
@@ -44,9 +48,7 @@ var_dump($b->name);
var_dump($b->settings);
?>
--EXPECTF--
-Warning: Creating default object from empty value in %sbug75573.php on line %d
-
-Notice: Only variable references should be returned by reference in %sbug75573.php on line %d
+Notice: Only variable references should be returned by reference in %s on line %d
string(3) "abc"
array(2) {
["foo"]=>
diff --git a/Zend/tests/bug75921.phpt b/Zend/tests/bug75921.phpt
index 917dd413cc..a8649262b5 100644
--- a/Zend/tests/bug75921.phpt
+++ b/Zend/tests/bug75921.phpt
@@ -3,78 +3,65 @@ Bug #75921: Inconsistent error when creating stdObject from empty variable
--FILE--
<?php
-$null->a = 42;
+try {
+ $null->a = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a['hello'] = 42;
+try {
+ $null->a['hello'] = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a->b = 42;
+try {
+ $null->a->b = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a['hello']->b = 42;
+try {
+ $null->a['hello']->b = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a->b['hello'] = 42;
+try {
+ $null->a->b['hello'] = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
?>
--EXPECTF--
-Warning: Creating default object from empty value in %sbug75921.php on line 3
-object(stdClass)#1 (1) {
- ["a"]=>
- int(42)
-}
+Attempt to assign property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 7
-object(stdClass)#1 (1) {
- ["a"]=>
- array(1) {
- ["hello"]=>
- int(42)
- }
-}
-
-Warning: Creating default object from empty value in %sbug75921.php on line 11
-
-Warning: Creating default object from empty value in %sbug75921.php on line 11
-object(stdClass)#1 (1) {
- ["a"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- int(42)
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 15
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 15
-object(stdClass)#1 (1) {
- ["a"]=>
- array(1) {
- ["hello"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- int(42)
- }
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 19
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 19
-object(stdClass)#1 (1) {
- ["a"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- array(1) {
- ["hello"]=>
- int(42)
- }
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
diff --git a/Zend/tests/bug76025.phpt b/Zend/tests/bug76025.phpt
index 2619984d1e..903cec2607 100644
--- a/Zend/tests/bug76025.phpt
+++ b/Zend/tests/bug76025.phpt
@@ -13,6 +13,6 @@ $c = $b[$a];
--EXPECTF--
Fatal error: Uncaught Exception: blah in %sbug76025.php:%d
Stack trace:
-#0 %sbug76025.php(%d): handleError(8, 'Undefined varia...', '%s', %d, Array)
+#0 %s(%d): handleError(2, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %sbug76025.php on line %d
diff --git a/Zend/tests/bug76534.phpt b/Zend/tests/bug76534.phpt
index 956a29ba2c..457d09f400 100644
--- a/Zend/tests/bug76534.phpt
+++ b/Zend/tests/bug76534.phpt
@@ -12,6 +12,6 @@ $y = &$x["bar"];
--EXPECTF--
Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
Stack trace:
-#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array)
+#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d)
#1 {main}
thrown in %sbug76534.php on line %d
diff --git a/Zend/tests/bug76667.phpt b/Zend/tests/bug76667.phpt
index 15dc34693d..09f17b56c7 100644
--- a/Zend/tests/bug76667.phpt
+++ b/Zend/tests/bug76667.phpt
@@ -19,20 +19,20 @@ $x = new T;
$x->x = 1;
?>
--EXPECTF--
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property '1' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property 'NAN' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property 'NAN' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
diff --git a/Zend/tests/bug76860.phpt b/Zend/tests/bug76860.phpt
index 046edba7f2..67baa3996f 100644
--- a/Zend/tests/bug76860.phpt
+++ b/Zend/tests/bug76860.phpt
@@ -17,15 +17,15 @@ new B;
--EXPECTF--
Notice: Accessing static property B::$a as non static in %sbug76860.php on line 7
-Notice: Undefined property: B::$a in %sbug76860.php on line 7
+Warning: Undefined property: B::$a in %s on line %d
Notice: Accessing static property B::$b as non static in %sbug76860.php on line 7
-Notice: Undefined property: B::$b in %sbug76860.php on line 7
+Warning: Undefined property: B::$b in %s on line %d
Notice: Accessing static property B::$c as non static in %sbug76860.php on line 7
-Notice: Undefined property: B::$c in %sbug76860.php on line 7
+Warning: Undefined property: B::$c in %s on line %d
NULL
NULL
NULL
diff --git a/Zend/tests/bug76860_2.phpt b/Zend/tests/bug76860_2.phpt
index bc92702fc1..1ab85f69f2 100644
--- a/Zend/tests/bug76860_2.phpt
+++ b/Zend/tests/bug76860_2.phpt
@@ -20,15 +20,15 @@ new B;
--EXPECTF--
Notice: Accessing static property B::$a as non static in %sbug76860_2.php on line 7
-Notice: Undefined property: B::$a in %sbug76860_2.php on line 7
+Warning: Undefined property: B::$a in %s on line %d
Notice: Accessing static property B::$b as non static in %sbug76860_2.php on line 7
-Notice: Undefined property: B::$b in %sbug76860_2.php on line 7
+Warning: Undefined property: B::$b in %s on line %d
Notice: Accessing static property B::$c as non static in %sbug76860_2.php on line 7
-Notice: Undefined property: B::$c in %sbug76860_2.php on line 7
+Warning: Undefined property: B::$c in %s on line %d
NULL
NULL
NULL
diff --git a/Zend/tests/bug77494.phpt b/Zend/tests/bug77494.phpt
index 1793f6b219..adab05bef7 100644
--- a/Zend/tests/bug77494.phpt
+++ b/Zend/tests/bug77494.phpt
@@ -12,5 +12,5 @@ var_dump($a->name);
--EXPECTF--
Warning: CURLFile() has been disabled for security reasons in %sbug77494.php on line 2
-Notice: Undefined property: CURLFile::$name in %sbug77494.php on line 3
+Warning: Undefined property: CURLFile::$name in %s on line %d
NULL
diff --git a/Zend/tests/bug77738.phpt b/Zend/tests/bug77738.phpt
index e3a453c405..c664a31344 100644
--- a/Zend/tests/bug77738.phpt
+++ b/Zend/tests/bug77738.phpt
@@ -5,4 +5,7 @@ Bug #77738 (Nullptr deref in zend_compile_expr)
__COMPILER_HALT_OFFSET__;
; // <- important
--EXPECTF--
-Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' %sbug77738.php on line %d
+Fatal error: Uncaught Error: Undefined constant '__COMPILER_HALT_OFFSET__' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug78182.phpt b/Zend/tests/bug78182.phpt
index 4b0f08dc3b..d7f10e94df 100644
--- a/Zend/tests/bug78182.phpt
+++ b/Zend/tests/bug78182.phpt
@@ -4,12 +4,13 @@ Bug #78182: Segmentation fault during by-reference property assignment
<?php
$varName = 'var';
$propName = 'prop';
-$$varName->$propName =& $$varName;
+try {
+ $$varName->$propName =& $$varName;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($var);
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
-object(stdClass)#1 (1) {
- ["prop"]=>
- *RECURSION*
-}
+--EXPECT--
+Attempt to modify property 'prop' of non-object
+NULL
diff --git a/Zend/tests/bug78531.phpt b/Zend/tests/bug78531.phpt
index ba460ee05a..1e8f0b34d1 100644
--- a/Zend/tests/bug78531.phpt
+++ b/Zend/tests/bug78531.phpt
@@ -2,17 +2,36 @@
Bug #78531 (Crash when using undefined variable as object)
--FILE--
<?php
-@$u1->a += 5;
-var_dump($u1->a);
-@$x = ++$u2->a;
-var_dump($u2->a);
-@$x = $u3->a++;
-var_dump($u3->a);
-@$u4->a->a += 5;
-var_dump($u4->a->a);
+try {
+ $u1->a += 5;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $x = ++$u2->a;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $x = $u3->a++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $u4->a->a += 5;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECT--
-int(5)
-int(1)
-int(1)
-int(5) \ No newline at end of file
+--EXPECTF--
+Warning: Undefined variable: u1 in %s on line %d
+Attempt to assign property 'a' of non-object
+
+Warning: Undefined variable: u2 in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
+
+Warning: Undefined variable: u3 in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
+
+Warning: Undefined variable: u4 in %s on line %d
+Attempt to modify property 'a' of non-object
diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt
index 2887afa355..946be2a3c9 100644
--- a/Zend/tests/call_static_006.phpt
+++ b/Zend/tests/call_static_006.phpt
@@ -4,29 +4,15 @@ Testing __callStatic
<?php
class foo {
- public function aa() {
- print "ok\n";
- }
static function __callstatic($a, $b) {
var_dump($a);
}
}
-foo::aa();
-
-$b = 'AA';
-foo::$b();
-
foo::__construct();
?>
--EXPECTF--
-Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d
-ok
-
-Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d
-ok
-
Fatal error: Uncaught Error: Cannot call constructor in %s:%d
Stack trace:
#0 {main}
diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_func_001.phpt
index 15d0aec263..a6e43f3060 100644
--- a/Zend/tests/call_user_func_001.phpt
+++ b/Zend/tests/call_user_func_001.phpt
@@ -22,14 +22,20 @@ namespace testing {
call_user_func(__NAMESPACE__ .'\foobar', 'foobar');
$class = __NAMESPACE__ .'\foo';
- call_user_func(array(new $class, 'priv'), 'foobar');
- call_user_func(array(new $class, 'prot'), 'foobar');
+ try {
+ call_user_func(array(new $class, 'priv'), 'foobar');
+ } catch (\TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ call_user_func(array(new $class, 'prot'), 'foobar');
+ } catch (\TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
---EXPECTF--
+--EXPECT--
string(6) "foobar"
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv()
+call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot()
diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_func_002.phpt
index 454c6fda96..cc07ffab16 100644
--- a/Zend/tests/call_user_func_002.phpt
+++ b/Zend/tests/call_user_func_002.phpt
@@ -4,26 +4,38 @@ Testing call_user_func() with autoload and passing invalid params
<?php
spl_autoload_register(function ($class) {
- var_dump($class);
+ var_dump($class);
});
-call_user_func(array('foo', 'bar'));
-call_user_func(array('', 'bar'));
-call_user_func(array($foo, 'bar'));
-call_user_func(array($foo, ''));
+try {
+ call_user_func(array('foo', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array('', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array($foo, 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array($foo, ''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
string(3) "foo"
+call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found
+call_user_func() expects parameter 1 to be a valid callback, class '' not found
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found in %s on line %d
+Warning: Undefined variable: foo in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-Warning: call_user_func() expects parameter 1 to be a valid callback, class '' not found in %s on line %d
-
-Notice: Undefined variable: foo in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-
-Notice: Undefined variable: foo in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+Warning: Undefined variable: foo in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/call_user_func_004.phpt b/Zend/tests/call_user_func_004.phpt
deleted file mode 100644
index 7a2c4b8ffd..0000000000
--- a/Zend/tests/call_user_func_004.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Calling non-static method with call_user_func()
---FILE--
-<?php
-
-class foo {
- public function teste() {
- $this->a = 1;
- }
-}
-
-call_user_func(array('foo', 'teste'));
-
-?>
---EXPECTF--
-Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
-Stack trace:
-#0 %s(%d): foo::teste()
-#1 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt
index 9305e5849c..13d69fd60d 100644
--- a/Zend/tests/call_user_func_005.phpt
+++ b/Zend/tests/call_user_func_005.phpt
@@ -9,7 +9,7 @@ class foo {
return 1;
}
- public function teste() {
+ public static function teste() {
return foo::x(function &($a=1,$b) { });
}
}
@@ -18,7 +18,6 @@ var_dump(call_user_func(array('foo', 'teste')));
?>
--EXPECTF--
-Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d
string(1) "x"
array(1) {
[0]=>
diff --git a/Zend/tests/call_user_func_007.phpt b/Zend/tests/call_user_func_007.phpt
index ed44320c3f..d3f2747c13 100644
--- a/Zend/tests/call_user_func_007.phpt
+++ b/Zend/tests/call_user_func_007.phpt
@@ -13,7 +13,7 @@ var_dump($a);
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d
array(0) {
diff --git a/Zend/tests/call_user_func_array_invalid_type.phpt b/Zend/tests/call_user_func_array_invalid_type.phpt
new file mode 100644
index 0000000000..d1c70f0fef
--- /dev/null
+++ b/Zend/tests/call_user_func_array_invalid_type.phpt
@@ -0,0 +1,18 @@
+--TEST--
+call_user_func_array() generating TypeError
+--FILE--
+<?php
+class drv {
+ function func() {
+ }
+}
+
+$drv = new drv;
+try {
+ call_user_func_array(array($drv, 'func'), null);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+call_user_func_array() expects parameter 2 to be array, null given
diff --git a/Zend/tests/case_insensitive_constant_deprecation.phpt b/Zend/tests/case_insensitive_constant_deprecation.phpt
deleted file mode 100644
index e7a92c8c4c..0000000000
--- a/Zend/tests/case_insensitive_constant_deprecation.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-Case-insensitive constants are deprecated
---FILE--
-<?php
-
-namespace {
- define('FOO', 42, true); // Deprecated
- define('NS\FOO', 24, true); // Deprecated
-
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-
- var_dump(NS\FOO); // Ok
- var_dump(ns\FOO); // Ok
- var_dump(ns\foo); // Deprecated
-
- var_dump(defined('FOO')); // Ok
- var_dump(defined('foo')); // Ok
- var_dump(defined('NS\FOO')); // Ok
- var_dump(defined('ns\FOO')); // Ok
- var_dump(defined('ns\foo')); // Ok
-
- var_dump(constant('FOO')); // Ok
- var_dump(constant('foo')); // Deprecated
- var_dump(constant('NS\FOO')); // Ok
- var_dump(constant('ns\FOO')); // Ok
- var_dump(constant('ns\foo')); // Deprecated
-}
-
-namespace NS {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-}
-
-namespace ns {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-}
-
-namespace Other {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-
- var_dump(defined('FOO')); // Ok
- var_dump(defined('foo')); // Ok
- var_dump(defined('NS\FOO')); // Ok
- var_dump(defined('ns\FOO')); // Ok
- var_dump(defined('ns\foo')); // Ok
-
- var_dump(constant('FOO')); // Ok
- var_dump(constant('foo')); // Deprecated
- var_dump(constant('NS\FOO')); // Ok
- var_dump(constant('ns\FOO')); // Ok
- var_dump(constant('ns\foo')); // Deprecated
-
- const C1 = FOO; // Ok
- var_dump(C1);
- const C2 = foo; // Deprecated
- var_dump(C2);
- const C3 = 1 + FOO; // Ok
- var_dump(C3);
- const C4 = 1 + foo; // Deprecated
- var_dump(C4);
-}
-
-?>
---EXPECTF--
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 4
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 5
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 12
-int(24)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 21
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 24
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 29
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 34
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 39
-int(42)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 48
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 51
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 55
-int(42)
-int(43)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 59
-int(43)
diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt
index b3d245f1ed..cdff53c38f 100644
--- a/Zend/tests/cast_to_string.phpt
+++ b/Zend/tests/cast_to_string.phpt
Binary files differ
diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt
index a83dd75baf..2e61fef935 100644
--- a/Zend/tests/catch.phpt
+++ b/Zend/tests/catch.phpt
@@ -1,5 +1,5 @@
--TEST--
-catch shouldn't call __autoload
+catch shouldn't call autoloader
--FILE--
<?php
diff --git a/Zend/tests/class_exists_002.phpt b/Zend/tests/class_exists_002.phpt
index ebe04575af..5e5df1d371 100644
--- a/Zend/tests/class_exists_002.phpt
+++ b/Zend/tests/class_exists_002.phpt
@@ -12,15 +12,11 @@ var_dump(class_exists(NULL));
var_dump(class_exists('FOO'));
var_dump(class_exists('bar'));
var_dump(class_exists(1));
-var_dump(class_exists(new stdClass));
?>
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-
-Warning: class_exists() expects parameter 1 to be string, object given in %s on line %d
-NULL
diff --git a/Zend/tests/class_name_as_scalar_error_002.phpt b/Zend/tests/class_name_as_scalar_error_002.phpt
index cbea0c2dcc..ebb2dd4c27 100644
--- a/Zend/tests/class_name_as_scalar_error_002.phpt
+++ b/Zend/tests/class_name_as_scalar_error_002.phpt
@@ -11,9 +11,4 @@ namespace Foo\Bar {
}
?>
--EXPECTF--
-Deprecated: Cannot use "parent" when current class scope has no parent in %s on line %d
-
-Fatal error: Uncaught Error: Cannot use "parent" when current class scope has no parent in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
+Fatal error: Cannot use "parent" when current class scope has no parent in %s on line %d
diff --git a/Zend/tests/class_properties_const.phpt b/Zend/tests/class_properties_const.phpt
index 6f5471d20a..72b29519b4 100644
--- a/Zend/tests/class_properties_const.phpt
+++ b/Zend/tests/class_properties_const.phpt
@@ -13,13 +13,13 @@ var_dump($a->{1});
var_dump($a->{function(){}});
?>
--EXPECTF--
-Notice: Array to string conversion in %sclass_properties_const.php on line %d
+Warning: Array to string conversion in %s on line %d
runtime
-Notice: Undefined property: A::$Array in %sclass_properties_const.php on line %d
+Warning: Undefined property: A::$Array in %s on line %d
NULL
-Notice: Undefined property: A::$1 in %sclass_properties_const.php on line %d
+Warning: Undefined property: A::$1 in %s on line %d
NULL
Fatal error: Uncaught Error: Object of class Closure could not be converted to string in %s:%d
diff --git a/Zend/tests/clone_003.phpt b/Zend/tests/clone_003.phpt
index 2dd376cf65..02ff350ca2 100644
--- a/Zend/tests/clone_003.phpt
+++ b/Zend/tests/clone_003.phpt
@@ -7,7 +7,7 @@ $a = clone $b;
?>
--EXPECTF--
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
Fatal error: Uncaught Error: __clone method called on non-object in %s:%d
Stack trace:
diff --git a/Zend/tests/closure_012.phpt b/Zend/tests/closure_012.phpt
index bae8f56878..f02045f5b1 100644
--- a/Zend/tests/closure_012.phpt
+++ b/Zend/tests/closure_012.phpt
@@ -16,8 +16,8 @@ $lambda();
var_dump($i);
?>
--EXPECTF--
-Notice: Undefined variable: i in %sclosure_012.php on line 2
+Warning: Undefined variable: i in %s on line %d
-Notice: Undefined variable: i in %sclosure_012.php on line 7
+Warning: Undefined variable: i in %s on line %d
NULL
int(2)
diff --git a/Zend/tests/closure_025.phpt b/Zend/tests/closure_025.phpt
deleted file mode 100644
index b3d03a7ad9..0000000000
--- a/Zend/tests/closure_025.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Closure 025: Using closure in create_function()
---FILE--
-<?php
-
-$a = create_function('$x', 'return function($y) use ($x) { return $x * $y; };');
-
-var_dump($a(2)->__invoke(4));
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(8)
diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt
index 76754f9fba..9fc29a4f18 100644
--- a/Zend/tests/closure_027.phpt
+++ b/Zend/tests/closure_027.phpt
@@ -27,7 +27,7 @@ object(stdClass)#%d (0) {
}
NULL
-Notice: Undefined variable: y in %s on line %d
+Warning: Undefined variable: y in %s on line %d
Exception: Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s:%d
diff --git a/Zend/tests/closure_040.phpt b/Zend/tests/closure_040.phpt
index 231ab4081c..a5f52e70b0 100644
--- a/Zend/tests/closure_040.phpt
+++ b/Zend/tests/closure_040.phpt
@@ -25,21 +25,12 @@ $ca = $a->getIncrementor();
$cas = $a->getStaticIncrementor();
$ca->bindTo($a, array());
-$ca->bindTo(array(), 'A');
-$ca->bindTo($a, array(), "");
-$ca->bindTo();
$cas->bindTo($a, 'A');
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: Class 'Array' not found in %s on line %d
-Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25
-
-Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d
-
Warning: Cannot bind an instance to a static closure in %s on line %d
diff --git a/Zend/tests/closure_061.phpt b/Zend/tests/closure_061.phpt
index f01e393570..2c574c49c0 100644
--- a/Zend/tests/closure_061.phpt
+++ b/Zend/tests/closure_061.phpt
@@ -175,9 +175,7 @@ Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure
-------------------
bindTo(null, Cls::class):
-Unbinding $this of a method is deprecated
-
-Success!
+Cannot unbind $this of method
bindTo(new Cls, Cls::class):
Success!
@@ -210,10 +208,10 @@ bindTo(new ClsUnrelated, SplDoublyLinkedList::class):
Cannot bind method SplDoublyLinkedList::count() to object of class ClsUnrelated
bindTo(null, null):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(null, SplDoublyLinkedList::class):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(new SplDoublyLinkedList, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
diff --git a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt
index 17d39c052e..24df1d186a 100644
--- a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt
+++ b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt
@@ -17,4 +17,4 @@ try {
?>
--EXPECT--
-Failed to create closure from callable: non-static method A::method() should not be called statically
+Failed to create closure from callable: non-static method A::method() cannot be called statically
diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat_001.phpt
index 1e657954a9..b8fad29674 100644
--- a/Zend/tests/concat_001.phpt
+++ b/Zend/tests/concat_001.phpt
@@ -50,24 +50,24 @@ var_dump($d.$d);
echo "Done\n";
?>
--EXPECTF--
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(24) "Arraythis is test object"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(16) "Arraysome string"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(8) "Array222"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(13) "Array2323.444"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(10) "ArrayArray"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(24) "this is test objectArray"
string(30) "this is test objectsome string"
string(22) "this is test object222"
@@ -75,20 +75,20 @@ string(27) "this is test object2323.444"
string(38) "this is test objectthis is test object"
string(30) "some stringthis is test object"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(16) "some stringArray"
string(14) "some string222"
string(19) "some string2323.444"
string(22) "some stringsome string"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(8) "222Array"
string(22) "222this is test object"
string(14) "222some string"
string(11) "2222323.444"
string(6) "222222"
-Notice: Array to string conversion in %sconcat_001.php on line %d
+Warning: Array to string conversion in %s on line %d
string(13) "2323.444Array"
string(27) "2323.444this is test object"
string(19) "2323.444some string"
diff --git a/Zend/tests/constant_expressions_classes.phpt b/Zend/tests/constant_expressions_classes.phpt
index eed006bfe1..89cabc0f91 100644
--- a/Zend/tests/constant_expressions_classes.phpt
+++ b/Zend/tests/constant_expressions_classes.phpt
@@ -4,8 +4,6 @@ Constant scalar expressions with autoloading and classes
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
---SKIPIF--
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--FILE--
<?php
diff --git a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
index 52d2194e26..649c3a325a 100644
--- a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
+++ b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
@@ -8,7 +8,7 @@ const C2 = [C1, [] => 1];
?>
--EXPECTF--
-Fatal error: Uncaught Error: Illegal offset type in %s:%d
+Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt
index b0cf1db61f..ddb2e67307 100644
--- a/Zend/tests/constants_002.phpt
+++ b/Zend/tests/constants_002.phpt
@@ -4,7 +4,11 @@ Defining constants with non-scalar values
<?php
define('foo', new stdClass);
-var_dump(foo);
+try {
+ var_dump(foo);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
define('foo', fopen(__FILE__, 'r'));
var_dump(foo);
@@ -12,7 +16,5 @@ var_dump(foo);
?>
--EXPECTF--
Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
-
-Warning: Use of undefined constant foo - assumed 'foo' (this will throw an Error in a future version of PHP) in %s on line %d
-string(%d) "foo"
-resource(%d) of type (stream)
+Undefined constant 'foo'
+resource(5) of type (stream)
diff --git a/Zend/tests/constants_005.phpt b/Zend/tests/constants_005.phpt
index b5a3a6bd38..27ab0259d1 100644
--- a/Zend/tests/constants_005.phpt
+++ b/Zend/tests/constants_005.phpt
@@ -2,11 +2,10 @@
Persistent case insensitive and user defined constants
--FILE--
<?php
-var_dump(ZEND_THREAD_safe);
+var_dump(defined('ZEND_THREAD_safe'));
define("ZEND_THREAD_safe", 123);
var_dump(ZEND_THREAD_safe);
?>
---EXPECTF--
-Warning: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' (this will throw an Error in a future version of PHP) in %s on line %d
-string(16) "ZEND_THREAD_safe"
+--EXPECT--
+bool(false)
int(123)
diff --git a/Zend/tests/custom_assert_deprecation.phpt b/Zend/tests/custom_assert_forbidden.phpt
index b4e22843dd..492a656f39 100644
--- a/Zend/tests/custom_assert_deprecation.phpt
+++ b/Zend/tests/custom_assert_forbidden.phpt
@@ -9,4 +9,4 @@ function assert() {}
?>
--EXPECTF--
-Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics in %s on line %d
+Fatal error: Defining a custom assert() function is not allowed, as the function has special semantics in %s on line %d
diff --git a/Zend/tests/defined_fn_no_ns_fallback.phpt b/Zend/tests/defined_fn_no_ns_fallback.phpt
new file mode 100644
index 0000000000..6dc2b51ed6
--- /dev/null
+++ b/Zend/tests/defined_fn_no_ns_fallback.phpt
@@ -0,0 +1,16 @@
+--TEST--
+There should be no namespace fallback when using the defined() function
+--FILE--
+<?php
+
+namespace Foo;
+
+var_dump(\defined('Foo\PHP_INT_MAX'));
+
+$const = 'Foo\PHP_INT_MAX';
+var_dump(\defined($const));
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt
index 7290df7714..e17e5e85b6 100644
--- a/Zend/tests/dereference_002.phpt
+++ b/Zend/tests/dereference_002.phpt
@@ -70,7 +70,7 @@ array(2) {
}
int(1)
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Undefined offset: 4 in %s on line %d
diff --git a/Zend/tests/dereference_007.phpt b/Zend/tests/dereference_007.phpt
index e7df6a422d..afe6e9d5b2 100644
--- a/Zend/tests/dereference_007.phpt
+++ b/Zend/tests/dereference_007.phpt
@@ -33,5 +33,5 @@ print "ok\n";
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
ok
diff --git a/Zend/tests/dereference_010.phpt b/Zend/tests/dereference_010.phpt
index c63f6acaf9..c916352afa 100644
--- a/Zend/tests/dereference_010.phpt
+++ b/Zend/tests/dereference_010.phpt
@@ -21,10 +21,10 @@ var_dump(b()[1]);
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d
diff --git a/Zend/tests/dereference_014.phpt b/Zend/tests/dereference_014.phpt
index 189dca7a38..470c233a19 100644
--- a/Zend/tests/dereference_014.phpt
+++ b/Zend/tests/dereference_014.phpt
@@ -27,12 +27,12 @@ var_dump($h);
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property 'a' of non-object in %s on line %d
+Warning: Trying to get property 'a' of non-object in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property 'b' of non-object in %s on line %d
+Warning: Trying to get property 'b' of non-object in %s on line %d
NULL
diff --git a/Zend/tests/dynamic_call_001.phpt b/Zend/tests/dynamic_call_001.phpt
deleted file mode 100644
index 7f8a6c0b3d..0000000000
--- a/Zend/tests/dynamic_call_001.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing dynamic call to constructor (old-style)
---FILE--
-<?php
-
-class foo {
- public function foo() {
- }
-}
-
-$a = 'foo';
-
-$a::$a();
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
-
-Fatal error: Uncaught Error: Non-static method foo::foo() cannot be called statically in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/dynamic_call_004.phpt b/Zend/tests/dynamic_call_004.phpt
index 2f444b3ee6..9028b1c801 100644
--- a/Zend/tests/dynamic_call_004.phpt
+++ b/Zend/tests/dynamic_call_004.phpt
@@ -7,7 +7,7 @@ $a::$b();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
Fatal error: Uncaught Error: Class name must be a valid object or a string in %s:%d
Stack trace:
diff --git a/Zend/tests/dynamic_call_005.phpt b/Zend/tests/dynamic_call_005.phpt
index 840e298b82..91d1cb914c 100644
--- a/Zend/tests/dynamic_call_005.phpt
+++ b/Zend/tests/dynamic_call_005.phpt
@@ -6,24 +6,31 @@ Dynamic calls to scope introspection functions are forbidden
function test_calls($func) {
$i = 1;
- array_map($func, [['i' => new stdClass]]);
- var_dump($i);
+ try {
+ array_map($func, [['i' => new stdClass]]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
- $func(['i' => new stdClass]);
- var_dump($i);
+ try {
+ $func(['i' => new stdClass]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
- call_user_func($func, ['i' => new stdClass]);
- var_dump($i);
+ try {
+ call_user_func($func, ['i' => new stdClass]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test_calls('extract');
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
-
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
-
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
+--EXPECT--
+Cannot call extract() dynamically
+Cannot call extract() dynamically
+Cannot call extract() dynamically
diff --git a/Zend/tests/dynamic_call_006.phpt b/Zend/tests/dynamic_call_006.phpt
index 058e22fda0..e6ea719158 100644
--- a/Zend/tests/dynamic_call_006.phpt
+++ b/Zend/tests/dynamic_call_006.phpt
@@ -3,46 +3,56 @@ Dynamic calls to scope introspection functions are forbidden (function variation
--FILE--
<?php
function test() {
- $func = 'extract';
- $func(['a' => 'b']);
- $func = 'compact';
- $func(['a']);
-
- $func = 'parse_str';
- $func('a=b');
-
- $func = 'get_defined_vars';
- $func();
-
- $func = 'assert';
- $func('1==2');
-
- $func = 'func_get_args';
- $func();
-
- $func = 'func_get_arg';
- $func(1);
-
- $func = 'func_num_args';
- $func();
+ try {
+ $func = 'extract';
+ $func(['a' => 'b']);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'compact';
+ $func(['a']);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'get_defined_vars';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_get_args';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_get_arg';
+ $func(1);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_num_args';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
-
-Warning: Cannot call compact() dynamically in %s on line %d
-
-Warning: Cannot call parse_str() with a single argument dynamically in %s on line %d
-
-Warning: Cannot call get_defined_vars() dynamically in %s on line %d
-
-Warning: Cannot call assert() with string argument dynamically in %s on line %d
-
-Warning: Cannot call func_get_args() dynamically in %s on line %d
-
-Warning: Cannot call func_get_arg() dynamically in %s on line %d
-
-Warning: Cannot call func_num_args() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
+Cannot call compact() dynamically
+Cannot call get_defined_vars() dynamically
+Cannot call func_get_args() dynamically
+Cannot call func_get_arg() dynamically
+Cannot call func_num_args() dynamically
diff --git a/Zend/tests/dynamic_call_007.phpt b/Zend/tests/dynamic_call_007.phpt
index 61ae182914..f1312b95b4 100644
--- a/Zend/tests/dynamic_call_007.phpt
+++ b/Zend/tests/dynamic_call_007.phpt
@@ -5,13 +5,17 @@ Dynamic calls to scope introspection functions are forbidden (misoptimization)
function test() {
$i = 1;
- array_map('extract', [['i' => new stdClass]]);
+ try {
+ array_map('extract', [['i' => new stdClass]]);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
$i += 1;
var_dump($i);
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
int(2)
diff --git a/Zend/tests/dynamic_call_008.phpt b/Zend/tests/dynamic_call_008.phpt
index 24240472d1..1916bcf913 100644
--- a/Zend/tests/dynamic_call_008.phpt
+++ b/Zend/tests/dynamic_call_008.phpt
@@ -4,10 +4,14 @@ Don't optimize dynamic call to non-dynamic one if it drops the warning
<?php
function test() {
- ((string) 'extract')(['a' => 42]);
+ try {
+ ((string) 'extract')(['a' => 42]);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt
deleted file mode 100644
index f2cae3d875..0000000000
--- a/Zend/tests/each_001.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing each() with an undefined variable
---FILE--
-<?php
-
-each($foo);
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
diff --git a/Zend/tests/each_002.phpt b/Zend/tests/each_002.phpt
deleted file mode 100644
index 5454f5ce0f..0000000000
--- a/Zend/tests/each_002.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Testing each() with array and object
---FILE--
-<?php
-
-$a = new stdClass;
-$foo = each($a);
-var_dump($foo);
-
-$a = new stdClass;
-var_dump(each($a));
-
-$a = array(new stdClass);
-var_dump(each($a));
-
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-bool(false)
-bool(false)
-array(4) {
- [1]=>
- object(stdClass)#1 (0) {
- }
- ["value"]=>
- object(stdClass)#1 (0) {
- }
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
diff --git a/Zend/tests/each_003.phpt b/Zend/tests/each_003.phpt
deleted file mode 100644
index d0038c0561..0000000000
--- a/Zend/tests/each_003.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing each() with recursion
---INI--
-zend.enable_gc=1
---FILE--
-<?php
-
-$a = array(array());
-$a[] =& $a;
-
-var_dump(each($a[1]));
-
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- array(0) {
- }
- ["value"]=>
- array(0) {
- }
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
diff --git a/Zend/tests/entry_block_with_predecessors.phpt b/Zend/tests/entry_block_with_predecessors.phpt
index ffc3147f1c..45c3302fc0 100644
--- a/Zend/tests/entry_block_with_predecessors.phpt
+++ b/Zend/tests/entry_block_with_predecessors.phpt
@@ -28,6 +28,6 @@ test2();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
int(1)
int(2)
diff --git a/Zend/tests/errmsg_012.phpt b/Zend/tests/errmsg_012.phpt
deleted file mode 100644
index c914125af5..0000000000
--- a/Zend/tests/errmsg_012.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-errmsg: __autoload() must take exactly 1 argument
---FILE--
-<?php
-
-function __autoload($a, $b) {}
-
-echo "Done\n";
-?>
---EXPECTF--
-Fatal error: __autoload() must take exactly 1 argument in %s on line %d
diff --git a/Zend/tests/errmsg_013.phpt b/Zend/tests/errmsg_013.phpt
index 606282458b..037ef9b1aa 100644
--- a/Zend/tests/errmsg_013.phpt
+++ b/Zend/tests/errmsg_013.phpt
@@ -11,4 +11,4 @@ class test {
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Default value for parameters with array type can only be an array or NULL in %s on line %d
+Fatal error: Cannot use string as default value for parameter $a of type array in %s on line %d
diff --git a/Zend/tests/errmsg_045.phpt b/Zend/tests/errmsg_045.phpt
index fbb2528e28..6311eb30e5 100644
--- a/Zend/tests/errmsg_045.phpt
+++ b/Zend/tests/errmsg_045.phpt
@@ -10,11 +10,11 @@ set_error_handler(function($_, $msg, $file) {
/* This is just a particular example of a non-fatal compile-time error
* If this breaks in future, just find another example and use it instead */
-eval('class A { function test() { } } class B extends A { function test($a) { } }');
+eval('class A { private function __invoke() { } }');
?>
--EXPECTF--
-string(62) "Declaration of B::test($a) should be compatible with A::test()"
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
-Notice: Undefined variable: undefined in %s on line %d
+Warning: Undefined variable: undefined in %s on line %d
diff --git a/Zend/tests/error_reporting03.phpt b/Zend/tests/error_reporting03.phpt
index f344e9557b..b4fbbecca8 100644
--- a/Zend/tests/error_reporting03.phpt
+++ b/Zend/tests/error_reporting03.phpt
@@ -30,6 +30,6 @@ var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef2 in %s on line %d
+Warning: Undefined variable: undef2 in %s on line %d
int(32767)
Done
diff --git a/Zend/tests/error_reporting04.phpt b/Zend/tests/error_reporting04.phpt
index 5b476cdf7f..7cd555716a 100644
--- a/Zend/tests/error_reporting04.phpt
+++ b/Zend/tests/error_reporting04.phpt
@@ -18,6 +18,6 @@ var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef in %s on line %d
+Warning: Undefined variable: undef in %s on line %d
int(32767)
Done
diff --git a/Zend/tests/error_reporting05.phpt b/Zend/tests/error_reporting05.phpt
index 6ea76fda3e..9c1a7c48d6 100644
--- a/Zend/tests/error_reporting05.phpt
+++ b/Zend/tests/error_reporting05.phpt
@@ -27,8 +27,8 @@ var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef_value in %s on line %d
+Warning: Undefined variable: undef_value in %s on line %d
-Notice: Undefined variable: undef_name in %s on line %d
+Warning: Undefined variable: undef_name in %s on line %d
int(32767)
Done
diff --git a/Zend/tests/error_reporting08.phpt b/Zend/tests/error_reporting08.phpt
index 32cb6b8d16..868c879160 100644
--- a/Zend/tests/error_reporting08.phpt
+++ b/Zend/tests/error_reporting08.phpt
@@ -27,6 +27,6 @@ var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef3 in %s on line %d
+Warning: Undefined variable: undef3 in %s on line %d
int(32767)
Done
diff --git a/Zend/tests/error_reporting09.phpt b/Zend/tests/error_reporting09.phpt
index 3d723f36c0..287c25460f 100644
--- a/Zend/tests/error_reporting09.phpt
+++ b/Zend/tests/error_reporting09.phpt
@@ -24,8 +24,8 @@ var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: blah in %s on line %d
+Warning: Undefined variable: blah in %s on line %d
-Notice: Undefined variable: undef2 in %s on line %d
+Warning: Undefined variable: undef2 in %s on line %d
int(32767)
Done
diff --git a/Zend/tests/error_reporting10.phpt b/Zend/tests/error_reporting10.phpt
index 8b0c7b9923..c18c04d8f0 100644
--- a/Zend/tests/error_reporting10.phpt
+++ b/Zend/tests/error_reporting10.phpt
@@ -8,7 +8,6 @@ error_reporting(E_ALL);
function make_exception()
{
@$blah;
- str_replace();
error_reporting(0);
throw new Exception();
}
diff --git a/Zend/tests/exception_012.phpt b/Zend/tests/exception_012.phpt
deleted file mode 100644
index 4a1070330a..0000000000
--- a/Zend/tests/exception_012.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Test exception doesn't cause RSHUTDOWN bypass, variation 1
---INI--
-assert.bail=1
-assert.exception=1
---FILE--
-<?php
-
-$func = create_function('', 'define("Mommy", 1); assert(false);');
-$func();
-
-?>
---EXPECTHEADERS--
-Content-type: text/html; charset=UTF-8
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-Fatal error: Uncaught AssertionError: assert(false) in %sexception_012.php(%d) : runtime-created function:%d
-Stack trace:
-#0 %sexception_012.php(%d) : runtime-created function(%d): assert(false, 'assert(false)')
-#1 %sexception_012.php(%d): __lambda_func()
-#2 {main}
- thrown in %sexception_012.php(%d) : runtime-created function on line %d
diff --git a/Zend/tests/exception_017.phpt b/Zend/tests/exception_017.phpt
index 8d87ec6ee9..77fbf2d844 100644
--- a/Zend/tests/exception_017.phpt
+++ b/Zend/tests/exception_017.phpt
@@ -12,27 +12,29 @@ function foo(callable $x) {
try {
C::foo();
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo $e, "\n\n";
}
try {
foo("C::foo");
} catch (Error $e) {
- echo "\n";
- do {
- echo "Exception: " . $e->getMessage() . "\n";
- $e = $e->getPrevious();
- } while ($e instanceof Error);
+ echo $e, "\n\n";
}
C::foo();
?>
--EXPECTF--
-Exception: Cannot call abstract method C::foo() in %sexception_017.php on line %d
+Error: Cannot call abstract method C::foo() in %s:%d
+Stack trace:
+#0 {main}
+
+TypeError: Argument 1 passed to foo() must be callable, string given, called in %s on line %d and defined in %s:%d
+Stack trace:
+#0 %s(%d): foo('C::foo')
+#1 {main}
-Exception: Argument 1 passed to foo() must be callable, string given, called in %s on line %d
-Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %sexception_017.php:%d
+Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}
- thrown in %sexception_017.php on line %d
+ thrown in %s on line %d
diff --git a/Zend/tests/exception_handler_004.phpt b/Zend/tests/exception_handler_004.phpt
index 69a4136b08..6552141b73 100644
--- a/Zend/tests/exception_handler_004.phpt
+++ b/Zend/tests/exception_handler_004.phpt
@@ -5,8 +5,6 @@ exception handler tests - 4
set_exception_handler("fo");
set_exception_handler(array("", ""));
-set_exception_handler();
-set_exception_handler("foo", "bar");
echo "Done\n";
?>
@@ -14,8 +12,4 @@ echo "Done\n";
Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d
Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d
-
-Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: set_exception_handler() expects exactly 1 parameter, 2 given in %s on line %d
Done
diff --git a/Zend/tests/foreach_undefined.phpt b/Zend/tests/foreach_undefined.phpt
index aa4a160e6c..bc1d8bbc71 100644
--- a/Zend/tests/foreach_undefined.phpt
+++ b/Zend/tests/foreach_undefined.phpt
@@ -8,7 +8,7 @@ foreach($a as $val);
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
Done
diff --git a/Zend/tests/fr47160.phpt b/Zend/tests/fr47160.phpt
index 786183c0c1..6567804902 100644
--- a/Zend/tests/fr47160.phpt
+++ b/Zend/tests/fr47160.phpt
@@ -36,20 +36,6 @@ class Magic3 {
}
}
-$f = array('Hello','world');
-try {
- var_dump($f('you'));
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump(call_user_func($f, 'you'));
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-
-printf("-----\n");
-
$h= new Hello;
$f = array($h,'world');
var_dump($f('again'));
@@ -107,14 +93,6 @@ var_dump(call_user_func($f, 'you'));
?>
--EXPECTF--
-Deprecated: Non-static method Hello::world() should not be called statically in %s on line %d
-Hello, you
-Exception: Using $this when not in object context
-
-Deprecated: %son-static method Hello::world() should not be called statically in %s on line %d
-Hello, you
-Exception: Using $this when not in object context
------
Hello, again
object(Hello)#%d (0) {
}
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
index a8ba71c0bf..5c0770ff65 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
@@ -2,9 +2,10 @@
Call internal function with incorrect number of arguments
--FILE--
<?php
-substr("foo");
-array_diff([]);
---EXPECTF--
-Warning: substr() expects at least 2 parameters, 1 given in %s
-
-Warning: array_diff(): at least 2 parameters are required, 1 given in %s
+try {
+ substr("foo");
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+--EXPECT--
+substr() expects at least 2 parameters, 1 given
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
index 8775bece88..2134dfe0f6 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
@@ -5,14 +5,19 @@ Call internal function with incorrect number of arguments with strict types
declare(strict_types=1);
try {
substr("foo");
-} catch (\Error $e) {
+} catch (ArgumentCountError $e) {
echo get_class($e) . PHP_EOL;
echo $e->getMessage() . PHP_EOL;
}
-array_diff([]);
---EXPECTF--
+try {
+ array_diff([]);
+} catch (ArgumentCountError $e) {
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage(), "\n";
+}
+--EXPECT--
ArgumentCountError
substr() expects at least 2 parameters, 1 given
-
-Warning: array_diff(): at least 2 parameters are required, 1 given in %s
+ArgumentCountError
+At least 2 parameters are required, 1 given
diff --git a/Zend/tests/generators/throw_not_an_exception.phpt b/Zend/tests/generators/throw_not_an_exception.phpt
index 920d8eb847..abf9a3c894 100644
--- a/Zend/tests/generators/throw_not_an_exception.phpt
+++ b/Zend/tests/generators/throw_not_an_exception.phpt
@@ -12,9 +12,8 @@ $gen->throw(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
+Fatal error: Uncaught TypeError: Generator::throw() expects parameter 1 to be Throwable, object given in %s:%d
Stack trace:
-#0 [internal function]: gen()
-#1 %s(%d): Generator->throw(Object(stdClass))
-#2 {main}
+#0 %s(%d): Generator->throw(Object(stdClass))
+#1 {main}
thrown in %s on line %d
diff --git a/Zend/tests/get_class_vars_002.phpt b/Zend/tests/get_class_vars_002.phpt
index 23531e458d..475545ffe7 100644
--- a/Zend/tests/get_class_vars_002.phpt
+++ b/Zend/tests/get_class_vars_002.phpt
@@ -41,9 +41,9 @@ array(3) {
int(6)
}
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
-Notice: Undefined property: C::$c in %s on line %d
+Warning: Undefined property: C::$c in %s on line %d
int(1)
NULL
NULL
diff --git a/Zend/tests/globals_001.phpt b/Zend/tests/globals_001.phpt
index 9a9c5401fe..821f345b81 100644
--- a/Zend/tests/globals_001.phpt
+++ b/Zend/tests/globals_001.phpt
@@ -29,6 +29,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_002.phpt b/Zend/tests/globals_002.phpt
index d57e350092..f2f53a13f5 100644
--- a/Zend/tests/globals_002.phpt
+++ b/Zend/tests/globals_002.phpt
@@ -32,6 +32,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_003.phpt b/Zend/tests/globals_003.phpt
index cdd4d211af..24e8edd8aa 100644
--- a/Zend/tests/globals_003.phpt
+++ b/Zend/tests/globals_003.phpt
@@ -38,6 +38,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_004.phpt b/Zend/tests/globals_004.phpt
index 0f2f7f0764..9ba3866835 100644
--- a/Zend/tests/globals_004.phpt
+++ b/Zend/tests/globals_004.phpt
@@ -23,6 +23,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/halt_compiler5.phpt b/Zend/tests/halt_compiler5.phpt
index 71d973e4f7..51167b6c3b 100644
--- a/Zend/tests/halt_compiler5.phpt
+++ b/Zend/tests/halt_compiler5.phpt
@@ -5,4 +5,7 @@ Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
__COMPILER_HALT_OFFSET__;
{}
--EXPECTF--
-Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' (this will throw an Error in a future version of PHP) in %s on line %d
+Fatal error: Uncaught Error: Undefined constant '__COMPILER_HALT_OFFSET__' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/illegal_offset_unset_isset_empty.phpt b/Zend/tests/illegal_offset_unset_isset_empty.phpt
new file mode 100644
index 0000000000..9005053e67
--- /dev/null
+++ b/Zend/tests/illegal_offset_unset_isset_empty.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Using unset(), isset(), empty() with an illegal array offset throws
+--FILE--
+<?php
+
+$ary = [];
+try {
+ unset($ary[[]]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ isset($ary[[]]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ empty($ary[[]]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Illegal offset type in unset
+Illegal offset type in isset or empty
+Illegal offset type in isset or empty
diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt
index 25c95ba219..8c7461e4f7 100644
--- a/Zend/tests/incompat_ctx_user.phpt
+++ b/Zend/tests/incompat_ctx_user.phpt
@@ -4,18 +4,17 @@ Incompatible context call (non-internal function)
<?php
class A {
- function foo() { var_dump(get_class($this)); }
+ function foo() { var_dump(get_class($this)); }
}
class B {
- function bar() { A::foo(); }
+ function bar() { A::foo(); }
}
$b = new B;
try {
- $b->bar();
+ $b->bar();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Deprecated: Non-static method A::foo() should not be called statically in %s on line %d
-Exception: Using $this when not in object context
+Exception: Non-static method A::foo() cannot be called statically
diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt
index f247a420b5..453b5ca86f 100644
--- a/Zend/tests/indexing_001.phpt
+++ b/Zend/tests/indexing_001.phpt
@@ -7,32 +7,48 @@ $array=array(1);
$testvalues=array(null, 0, 1, true, false,'',' ',0.1,array());
foreach ($testvalues as $testvalue) {
- $testvalue['foo']=$array;
- var_dump ($testvalue);
+ try {
+ $testvalue['foo']=$array;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($testvalue);
}
echo "\n*** Indexing - Testing reference assignment with key ***\n";
$testvalues=array(null, 0, 1, true, false,0.1,array());
foreach ($testvalues as $testvalue) {
- $testvalue['foo']=&$array;
- var_dump ($testvalue);
+ try {
+ $testvalue['foo']=&$array;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($testvalue);
}
echo "*** Indexing - Testing value assignment no key ***\n";
$array=array(1);
$testvalues=array(null, 0, 1, true, false,0.1,array());
foreach ($testvalues as $testvalue) {
- $testvalue[]=$array;
- var_dump ($testvalue);
+ try {
+ $testvalue[]=$array;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump ($testvalue);
}
echo "\n*** Indexing - Testing reference assignment no key ***\n";
$testvalues=array(null, 0, 1, true, false,0.1,array());
foreach ($testvalues as $testvalue) {
- $testvalue[]=&$array;
- var_dump ($testvalue);
+ try {
+ $testvalue[]=&$array;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump ($testvalue);
}
@@ -47,14 +63,11 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(0)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(1)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
bool(true)
array(1) {
["foo"]=>
@@ -66,15 +79,14 @@ array(1) {
Warning: Illegal string offset 'foo' in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(1) "A"
Warning: Illegal string offset 'foo' in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(1) "A"
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -92,14 +104,11 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(0)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(1)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
bool(true)
array(1) {
["foo"]=>
@@ -108,8 +117,7 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -126,14 +134,11 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(0)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(1)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
bool(true)
array(1) {
[0]=>
@@ -142,8 +147,7 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
float(0.1)
array(1) {
[0]=>
@@ -161,14 +165,11 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(0)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
int(1)
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
bool(true)
array(1) {
[0]=>
@@ -177,8 +178,7 @@ array(1) {
int(1)
}
}
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
float(0.1)
array(1) {
[0]=>
diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_call_array_005.phpt
index 4938856ed2..bd11df2d12 100644
--- a/Zend/tests/indirect_call_array_005.phpt
+++ b/Zend/tests/indirect_call_array_005.phpt
@@ -19,10 +19,7 @@ $callback = ['TestClass', 'method'];
echo $callback();
?>
--EXPECTF--
-Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
+Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d
Stack trace:
-#0 %s(%d): TestClass::method()
-#1 {main}
+#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/indirect_call_string_003.phpt b/Zend/tests/indirect_call_string_003.phpt
index a6839df8a7..99289c4e1c 100644
--- a/Zend/tests/indirect_call_string_003.phpt
+++ b/Zend/tests/indirect_call_string_003.phpt
@@ -19,10 +19,7 @@ $callback = 'TestClass::method';
echo $callback();
?>
--EXPECTF--
-Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
+Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d
Stack trace:
-#0 %s(%d): TestClass::method()
-#1 {main}
+#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/inference_infinite_loop.phpt b/Zend/tests/inference_infinite_loop.phpt
index 1e94ea8040..ffa5cdbf89 100644
--- a/Zend/tests/inference_infinite_loop.phpt
+++ b/Zend/tests/inference_infinite_loop.phpt
@@ -14,4 +14,4 @@ test();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt
index 97d67ff567..662185dcea 100644
--- a/Zend/tests/instanceof.phpt
+++ b/Zend/tests/instanceof.phpt
@@ -1,5 +1,5 @@
--TEST--
-instanceof shouldn't call __autoload
+instanceof shouldn't call autoloader
--FILE--
<?php
spl_autoload_register(function ($name) {
diff --git a/Zend/tests/instanceof_001.phpt b/Zend/tests/instanceof_001.phpt
index 6bdcb896af..27170420f0 100644
--- a/Zend/tests/instanceof_001.phpt
+++ b/Zend/tests/instanceof_001.phpt
@@ -8,7 +8,7 @@ var_dump($a instanceof stdClass);
var_dump(new stdCLass instanceof stdClass);
-$b = create_function('', 'return new stdClass;');
+$b = function() { return new stdClass; };
var_dump($b() instanceof stdClass);
$c = array(new stdClass);
@@ -20,8 +20,6 @@ var_dump(@$inexistent instanceof stdClass);
--EXPECTF--
bool(true)
bool(true)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
bool(true)
bool(true)
bool(false)
diff --git a/Zend/tests/interface_exists_001.phpt b/Zend/tests/interface_exists_001.phpt
index ab20dd20ea..84e9c6df1e 100644
--- a/Zend/tests/interface_exists_001.phpt
+++ b/Zend/tests/interface_exists_001.phpt
@@ -9,13 +9,9 @@ interface foo {
var_dump(interface_exists('foo'));
var_dump(interface_exists(1));
var_dump(interface_exists(NULL));
-var_dump(interface_exists(new stdClass));
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(false)
bool(false)
-
-Warning: interface_exists() expects parameter 1 to be string, object given in %s on line %d
-NULL
diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt
index 3714d50a62..f37c4638a8 100644
--- a/Zend/tests/is_a.phpt
+++ b/Zend/tests/is_a.phpt
@@ -1,5 +1,5 @@
--TEST--
-is_a() and is_subclass_of() shouldn't call __autoload
+is_a() and is_subclass_of() shouldn't call autoloader
--INI--
error_reporting=14335
--FILE--
diff --git a/Zend/tests/isset_003.phpt b/Zend/tests/isset_003.phpt
index 06cbe3d51d..c80a174daf 100644
--- a/Zend/tests/isset_003.phpt
+++ b/Zend/tests/isset_003.phpt
@@ -29,13 +29,13 @@ bool(true)
bool(false)
bool(false)
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Undefined variable: d in %s on line %d
+Warning: Undefined variable: d in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property '' of non-object in %s on line %d
+Warning: Trying to get property '' of non-object in %s on line %d
bool(false)
bool(true)
bool(false)
diff --git a/Zend/tests/list_keyed_conversions.phpt b/Zend/tests/list_keyed_conversions.phpt
index bf0349b327..1dd48de9f2 100644
--- a/Zend/tests/list_keyed_conversions.phpt
+++ b/Zend/tests/list_keyed_conversions.phpt
@@ -29,6 +29,6 @@ int(1)
int(0)
int(1)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Notice: Undefined offset: 1 in %s on line %d
diff --git a/Zend/tests/method_argument_binding.phpt b/Zend/tests/method_argument_binding.phpt
index dea12621a3..32acd93c63 100644
--- a/Zend/tests/method_argument_binding.phpt
+++ b/Zend/tests/method_argument_binding.phpt
@@ -43,4 +43,4 @@ class E extends D {
--EXPECTF--
int(2)
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt
index 027aa64c20..63884abc79 100644
--- a/Zend/tests/methods-on-non-objects-call-user-func.phpt
+++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt
@@ -2,11 +2,12 @@
call_user_func() in combination with "Call to a member function method() on a non-object"
--FILE--
<?php
-$comparator= null;
-var_dump(call_user_func([$comparator, 'compare'], 1, 2));
-echo "Alive\n";
+$comparator = null;
+try {
+ var_dump(call_user_func([$comparator, 'compare'], 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-NULL
-Alive
+--EXPECT--
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/nowdoc_015.phpt b/Zend/tests/nowdoc_015.phpt
index 9eb83bd063..56de362dd5 100644
--- a/Zend/tests/nowdoc_015.phpt
+++ b/Zend/tests/nowdoc_015.phpt
@@ -2,7 +2,7 @@
Test nowdoc and line numbering
--FILE--
<?php
-function error_handler($num, $msg, $file, $line, $vars) {
+function error_handler($num, $msg, $file, $line) {
echo $line,"\n";
}
set_error_handler('error_handler');
diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt
index bd9dfbd093..3a2fe7758b 100644
--- a/Zend/tests/ns_041.phpt
+++ b/Zend/tests/ns_041.phpt
@@ -17,5 +17,7 @@ ok
ok
ok
-Warning: Use of undefined constant BAR - assumed 'BAR' (this will throw an Error in a future version of PHP) in %sns_041.php on line 9
-BAR
+Fatal error: Uncaught Error: Undefined constant 'test\ns1\BAR' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/ns_076.phpt b/Zend/tests/ns_076.phpt
index ea97e924b1..0db8aeba62 100644
--- a/Zend/tests/ns_076.phpt
+++ b/Zend/tests/ns_076.phpt
@@ -3,26 +3,28 @@
--FILE--
<?php
namespace foo;
+use Error;
-$a = array(unknown => unknown);
-
-echo unknown;
-echo "\n";
-var_dump($a);
-echo \unknown;
---EXPECTF--
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
+try {
+ $a = array(unknown => unknown);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
+try {
+ echo unknown;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
-unknown
-array(1) {
- ["unknown"]=>
- %s(7) "unknown"
+try {
+ echo \unknown;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_076.php:%d
-Stack trace:
-#0 {main}
- thrown in %sns_076.php on line %d
+?>
+--EXPECT--
+Undefined constant 'foo\unknown'
+Undefined constant 'foo\unknown'
+Undefined constant 'unknown'
diff --git a/Zend/tests/object_types/invalid_default_value.phpt b/Zend/tests/object_types/invalid_default_value.phpt
index 2768e00e7d..39272b05c0 100644
--- a/Zend/tests/object_types/invalid_default_value.phpt
+++ b/Zend/tests/object_types/invalid_default_value.phpt
@@ -7,4 +7,4 @@ function test(object $obj = 42) { }
?>
--EXPECTF--
-Fatal error: Default value for parameters with an object type can only be NULL in %s on line %d
+Fatal error: Cannot use int as default value for parameter $obj of type object in %s on line %d
diff --git a/Zend/tests/objects_002.phpt b/Zend/tests/objects_002.phpt
index 1c45b2230c..66cc09129f 100644
--- a/Zend/tests/objects_002.phpt
+++ b/Zend/tests/objects_002.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg) should be compatible with test::foo() in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg) must be compatible with test::foo() in %s on line %d
diff --git a/Zend/tests/objects_003.phpt b/Zend/tests/objects_003.phpt
index 4486888c40..300cda0cd9 100644
--- a/Zend/tests/objects_003.phpt
+++ b/Zend/tests/objects_003.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, $arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, $arg2) should be compatible with test::foo($arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, $arg2) must be compatible with test::foo($arg) in %s on line %d
diff --git a/Zend/tests/objects_004.phpt b/Zend/tests/objects_004.phpt
index 1cc90384a7..7c9ca452c8 100644
--- a/Zend/tests/objects_004.phpt
+++ b/Zend/tests/objects_004.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo(&$arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo(&$arg) should be compatible with test::foo($arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo(&$arg) must be compatible with test::foo($arg) in %s on line %d
diff --git a/Zend/tests/objects_005.phpt b/Zend/tests/objects_005.phpt
index a2369b731a..6007ccbbc9 100644
--- a/Zend/tests/objects_005.phpt
+++ b/Zend/tests/objects_005.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo() {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo() should be compatible with & test::foo() in %s on line %d
-Done
+Fatal error: Declaration of test3::foo() must be compatible with & test::foo() in %s on line %d
diff --git a/Zend/tests/objects_006.phpt b/Zend/tests/objects_006.phpt
index ed6ea6047a..e520342180 100644
--- a/Zend/tests/objects_006.phpt
+++ b/Zend/tests/objects_006.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, $arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, $arg2) should be compatible with test::foo($arg, $arg2 = NULL) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, $arg2) must be compatible with test::foo($arg, $arg2 = NULL) in %s on line %d
diff --git a/Zend/tests/objects_007.phpt b/Zend/tests/objects_007.phpt
index 3094d60e8e..2df30b9068 100644
--- a/Zend/tests/objects_007.phpt
+++ b/Zend/tests/objects_007.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo($arg, &$arg2) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo($arg, &$arg2) should be compatible with test::foo($arg, &$arg2 = NULL) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo($arg, &$arg2) must be compatible with test::foo($arg, &$arg2 = NULL) in %s on line %d
diff --git a/Zend/tests/objects_008.phpt b/Zend/tests/objects_008.phpt
index 6554be99eb..b563061051 100644
--- a/Zend/tests/objects_008.phpt
+++ b/Zend/tests/objects_008.phpt
@@ -17,8 +17,6 @@ class test3 extends test {
function foo(Test3 $arg) {}
}
-echo "Done\n";
?>
--EXPECTF--
-Warning: Declaration of test3::foo(Test3 $arg) should be compatible with test::foo(Test $arg) in %s on line %d
-Done
+Fatal error: Declaration of test3::foo(Test3 $arg) must be compatible with test::foo(Test $arg) in %s on line %d
diff --git a/Zend/tests/objects_020.phpt b/Zend/tests/objects_020.phpt
deleted file mode 100644
index 4b0e0d1ec7..0000000000
--- a/Zend/tests/objects_020.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Accessing members of standard object through of variable variable
---FILE--
-<?php
-
-error_reporting(E_ALL);
-
-$test = 'stdclass';
-
-$$test->a =& $$test;
-$$test->a->b[] = 2;
-
-var_dump($$test);
-
-?>
---EXPECTF--
-Warning: Creating default object from empty value in %sobjects_020.php on line 7
-object(stdClass)#%d (2) {
- ["a"]=>
- *RECURSION*
- ["b"]=>
- array(1) {
- [0]=>
- int(2)
- }
-}
diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt
index 6ee7d5a491..b579278f2e 100644
--- a/Zend/tests/objects_027.phpt
+++ b/Zend/tests/objects_027.phpt
@@ -17,26 +17,12 @@ class foo extends bar {
$foo = new foo;
$foo->test();
-$foo::test();
call_user_func(array($foo, 'test'));
-call_user_func(array('foo', 'test'));
?>
--EXPECTF--
object(foo)#%d (0) {
}
-
-Deprecated: Non-static method foo::test() should not be called statically in %s on line %d
-
-Deprecated: Non-static method bar::show() should not be called statically in %s on line %d
-object(foo)#%d (0) {
-}
-object(foo)#%d (0) {
-}
-
-Deprecated: %son-static method foo::test() should not be called statically in %s on line %d
-
-Deprecated: Non-static method bar::show() should not be called statically in %s on line %d
object(foo)#%d (0) {
}
diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt
index a1d0a43c69..97b6a06b1c 100644
--- a/Zend/tests/offset_array.phpt
+++ b/Zend/tests/offset_array.phpt
@@ -17,10 +17,18 @@ $fp = fopen(__FILE__, "r");
var_dump($arr[$fp]);
$obj = new stdClass;
-var_dump($arr[$obj]);
+try {
+ var_dump($arr[$obj]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr1 = Array(1,2,3);
-var_dump($arr[$arr1]);
+try {
+ var_dump($arr[$arr1]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -36,12 +44,8 @@ NULL
int(2)
int(1)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
int(%d)
-
-Warning: Illegal offset type in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-NULL
+Illegal offset type
+Illegal offset type
Done
diff --git a/Zend/tests/offset_bool.phpt b/Zend/tests/offset_bool.phpt
index 8ed9f28e43..ae8df6d2b5 100644
--- a/Zend/tests/offset_bool.phpt
+++ b/Zend/tests/offset_bool.phpt
@@ -25,30 +25,30 @@ var_dump($bool[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_long.phpt b/Zend/tests/offset_long.phpt
index 4c6b3972d2..17dfe0d29b 100644
--- a/Zend/tests/offset_long.phpt
+++ b/Zend/tests/offset_long.phpt
@@ -25,30 +25,30 @@ var_dump($long[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_null.phpt b/Zend/tests/offset_null.phpt
index ad0b1f3049..ae02eece77 100644
--- a/Zend/tests/offset_null.phpt
+++ b/Zend/tests/offset_null.phpt
@@ -25,30 +25,30 @@ var_dump($null[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
index 3ad48e7412..1a9667cb8f 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -17,23 +17,35 @@ var_dump($str[TRUE]);
var_dump($str[FALSE]);
$fp = fopen(__FILE__, "r");
-var_dump($str[$fp]);
+try {
+ var_dump($str[$fp]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$obj = new stdClass;
-var_dump($str[$obj]);
+try {
+ var_dump($str[$obj]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr = Array(1,2,3);
-var_dump($str[$arr]);
+try {
+ var_dump($str[$arr]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
string(1) "i"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
Warning: Illegal string offset 'run away' in %s on line %d
@@ -46,20 +58,14 @@ string(1) "o"
Notice: A non well formed numeric value encountered in %s on line %d
string(1) "r"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "i"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
-
-Warning: Illegal offset type in %s on line %d
-string(1) "%s"
-
-Warning: Illegal offset type in %s on line %d
+Illegal offset type
Notice: Object of class stdClass could not be converted to int in %s on line %d
-string(1) "%s"
-
-Warning: Illegal offset type in %s on line %d
-string(1) "i"
+Illegal offset type
+Illegal offset type
Done
diff --git a/Zend/tests/overloaded_func_001.phpt b/Zend/tests/overloaded_func_001.phpt
index 31585d505a..7fc435f920 100644
--- a/Zend/tests/overloaded_func_001.phpt
+++ b/Zend/tests/overloaded_func_001.phpt
@@ -6,10 +6,10 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
?>
--FILE--
<?php
+$o = new _ZendTestChildClass();
+var_dump($o->test());
var_dump(_ZendTestClass::test());
?>
---EXPECTF--
-Fatal error: Uncaught Error: Cannot call overloaded function for non-object in %soverloaded_func_001.php:%d
-Stack trace:
-#0 {main}
- thrown in %soverloaded_func_001.php on line %d
+--EXPECT--
+string(4) "test"
+string(4) "test"
diff --git a/Zend/tests/parse_str_with_unpack.phpt b/Zend/tests/parse_str_with_unpack.phpt
deleted file mode 100644
index 8daa711374..0000000000
--- a/Zend/tests/parse_str_with_unpack.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Calling parse_str through argument unpacking
---FILE--
-<?php
-
-function test() {
- $i = 0;
- parse_str(...["i=41"]);
- var_dump($i + 1);
-}
-test();
-
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-int(42)
diff --git a/Zend/tests/php_errormsg_misoptimization.phpt b/Zend/tests/php_errormsg_misoptimization.phpt
deleted file mode 100644
index ae389db248..0000000000
--- a/Zend/tests/php_errormsg_misoptimization.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-The variable $php_errormsg shouldn't be optimized as it may be unpredictably modified
---INI--
-track_errors=1
---FILE--
-<?php
-
-function test() {
- $php_errormsg = 1;
- echo $undef;
- var_dump($php_errormsg + 1);
-}
-test();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: undef in %s on line %d
-
-Warning: A non-numeric value encountered in %s on line %d
-int(1)
diff --git a/Zend/tests/result_unused.phpt b/Zend/tests/result_unused.phpt
index 12892e8415..263755beb0 100644
--- a/Zend/tests/result_unused.phpt
+++ b/Zend/tests/result_unused.phpt
@@ -24,5 +24,5 @@ $x->prop;
$x->y;
echo "ok\n";
--EXPECTF--
-Notice: Uninitialized string offset: 3 in %sresult_unused.php on line %d
+Warning: Uninitialized string offset: 3 in %s on line %d
ok
diff --git a/Zend/tests/return_types/023.phpt b/Zend/tests/return_types/023.phpt
deleted file mode 100644
index e8e8732ef1..0000000000
--- a/Zend/tests/return_types/023.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-PHP 4 Constructors cannot declare a return type
---FILE--
-<?php
-
-class Foo {
- function foo() : Foo {}
-}
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in %s on line %d
-
-Fatal error: Constructor %s::%s() cannot declare a return type in %s on line %d
diff --git a/Zend/tests/return_types/bug71978.phpt b/Zend/tests/return_types/bug71978.phpt
index e3c8440212..cfe8905dec 100644
--- a/Zend/tests/return_types/bug71978.phpt
+++ b/Zend/tests/return_types/bug71978.phpt
@@ -2,12 +2,6 @@
Bug #71978 (Existence of return type hint affects other compatibility rules)
--FILE--
<?php
-class A {
- function foo(int $a) {}
-}
-class B extends A {
- function foo(string $a) {}
-}
class A1 {
function foo(int $a): int {}
}
@@ -16,6 +10,4 @@ class B1 extends A1 {
}
?>
--EXPECTF--
-Warning: Declaration of B::foo(string $a) should be compatible with A::foo(int $a) in %s on line %d
-
-Warning: Declaration of B1::foo(string $a): int should be compatible with A1::foo(int $a): int in %s on line %d
+Fatal error: Declaration of B1::foo(string $a): int must be compatible with A1::foo(int $a): int in %s on line %d
diff --git a/Zend/tests/settype_string.phpt b/Zend/tests/settype_string.phpt
index 3a2d59ecae..0c97450051 100644
--- a/Zend/tests/settype_string.phpt
+++ b/Zend/tests/settype_string.phpt
Binary files differ
diff --git a/Zend/tests/str_offset_001.phpt b/Zend/tests/str_offset_001.phpt
index 3317674857..04fadd3023 100644
--- a/Zend/tests/str_offset_001.phpt
+++ b/Zend/tests/str_offset_001.phpt
@@ -28,19 +28,19 @@ string(1) "a"
string(1) "b"
string(1) "c"
-Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
+Warning: Uninitialized string offset: 3 in %s on line %d
string(0) ""
string(1) "b"
-Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
+Warning: Uninitialized string offset: 1 in %s on line %d
string(0) ""
string(1) "a"
string(1) "b"
string(1) "c"
-Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
+Warning: Uninitialized string offset: 3 in %s on line %d
string(0) ""
string(1) "b"
-Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
+Warning: Uninitialized string offset: 1 in %s on line %d
string(0) ""
diff --git a/Zend/tests/str_offset_003.phpt b/Zend/tests/str_offset_003.phpt
index e357ac0c01..4101ce522a 100644
--- a/Zend/tests/str_offset_003.phpt
+++ b/Zend/tests/str_offset_003.phpt
@@ -20,18 +20,18 @@ foo($str[2][-2]);
foo($str[2][-1]);
?>
--EXPECTF--
-Notice: Uninitialized string offset: -10 in %sstr_offset_003.php on line %d
+Warning: Uninitialized string offset: -10 in %s on line %d
string(0) ""
string(1) "d"
-Notice: Uninitialized string offset: -2 in %sstr_offset_003.php on line %d
+Warning: Uninitialized string offset: -2 in %s on line %d
string(0) ""
string(1) "c"
-Notice: Uninitialized string offset: -10 in %sstr_offset_003.php on line %d
+Warning: Uninitialized string offset: -10 in %s on line %d
string(0) ""
string(1) "d"
-Notice: Uninitialized string offset: -2 in %sstr_offset_003.php on line %d
+Warning: Uninitialized string offset: -2 in %s on line %d
string(0) ""
string(1) "c"
diff --git a/Zend/tests/strict_001.phpt b/Zend/tests/strict_001.phpt
index 3fcaa8c2bc..54c5a76c48 100644
--- a/Zend/tests/strict_001.phpt
+++ b/Zend/tests/strict_001.phpt
@@ -14,6 +14,6 @@ var_dump($array[$fp]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
int(%d)
Done
diff --git a/Zend/tests/this_in_extract.phpt b/Zend/tests/this_in_extract.phpt
index 9903d7d794..ef0a25a279 100644
--- a/Zend/tests/this_in_extract.phpt
+++ b/Zend/tests/this_in_extract.phpt
@@ -15,5 +15,5 @@ foo();
--EXPECTF--
Cannot re-assign $this
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
diff --git a/Zend/tests/this_in_mb_parse_str.phpt b/Zend/tests/this_in_mb_parse_str.phpt
deleted file mode 100644
index 2d5af4794e..0000000000
--- a/Zend/tests/this_in_mb_parse_str.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-$this re-assign in mb_parse_str()
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-function foo() {
- mb_parse_str("this=42");
- var_dump($this);
-}
-foo();
-?>
---EXPECTF--
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-
-Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_mb_parse_str.php:3
-Stack trace:
-#0 %sthis_in_mb_parse_str.php(3): mb_parse_str('this=42')
-#1 %sthis_in_mb_parse_str.php(6): foo()
-#2 {main}
- thrown in %sthis_in_mb_parse_str.php on line 3
diff --git a/Zend/tests/this_in_parse_str.phpt b/Zend/tests/this_in_parse_str.phpt
deleted file mode 100644
index 0bd9064d60..0000000000
--- a/Zend/tests/this_in_parse_str.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-$this re-assign in parse_str()
---FILE--
-<?php
-function foo() {
- parse_str("this=42");
- var_dump($this);
-}
-foo();
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-
-Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_parse_str.php:3
-Stack trace:
-#0 %sthis_in_parse_str.php(3): parse_str('this=42')
-#1 %sthis_in_parse_str.php(6): foo()
-#2 {main}
- thrown in %sthis_in_parse_str.php on line 3
diff --git a/Zend/tests/trait_exists_001.phpt b/Zend/tests/trait_exists_001.phpt
index 10ce3fa0cb..8a7c55d586 100644
--- a/Zend/tests/trait_exists_001.phpt
+++ b/Zend/tests/trait_exists_001.phpt
@@ -9,13 +9,9 @@ trait foo {
var_dump(trait_exists('foo'));
var_dump(trait_exists(1));
var_dump(trait_exists(NULL));
-var_dump(trait_exists(new stdClass));
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(false)
bool(false)
-
-Warning: trait_exists() expects parameter 1 to be string, object given in %s on line %d
-NULL
diff --git a/Zend/tests/traits/bug55554a.phpt b/Zend/tests/traits/bug55554a.phpt
deleted file mode 100644
index dd844ba661..0000000000
--- a/Zend/tests/traits/bug55554a.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// All constructors should be registered as such
-
-trait TConstructor {
- public function constructor() {
- echo "ctor executed\n";
- }
-}
-
-class NewConstructor {
- use TConstructor {
- constructor as __construct;
- }
-}
-
-class LegacyConstructor {
- use TConstructor {
- constructor as LegacyConstructor;
- }
-}
-
-echo "New constructor: ";
-$o = new NewConstructor;
-
-echo "Legacy constructor: ";
-$o = new LegacyConstructor;
---EXPECT--
-New constructor: ctor executed
-Legacy constructor: ctor executed
diff --git a/Zend/tests/traits/bug55554b.phpt b/Zend/tests/traits/bug55554b.phpt
deleted file mode 100644
index 65ecb7adaf..0000000000
--- a/Zend/tests/traits/bug55554b.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-trait TConstructor {
- public function foo() {
- echo "foo executed\n";
- }
- public function bar() {
- echo "bar executed\n";
- }
-}
-
-class OverridingIsSilent1 {
- use TConstructor {
- foo as __construct;
- }
-
- public function __construct() {
- echo "OverridingIsSilent1 __construct\n";
- }
-}
-
-$o = new OverridingIsSilent1;
-
-class OverridingIsSilent2 {
- use TConstructor {
- foo as OverridingIsSilent2;
- }
-
- public function OverridingIsSilent2() {
- echo "OverridingIsSilent2 OverridingIsSilent2\n";
- }
-}
-
-$o = new OverridingIsSilent2;
-
-class ReportCollision {
- use TConstructor {
- bar as ReportCollision;
- foo as __construct;
- }
-}
-
-
-echo "ReportCollision: ";
-$o = new ReportCollision;
---EXPECTF--
-OverridingIsSilent1 __construct
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OverridingIsSilent2 has a deprecated constructor in %s on line %d
-OverridingIsSilent2 OverridingIsSilent2
-
-Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
diff --git a/Zend/tests/traits/bug55554c.phpt b/Zend/tests/traits/bug55554c.phpt
deleted file mode 100644
index 420689259e..0000000000
--- a/Zend/tests/traits/bug55554c.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// Test that the behavior is consistent with the existing handling of new
-// and legacy constructors.
-// Here, the traits conflicts are overridden by local definitions,
-// and the two constructor definitions do not directly collide in that case.
-
-trait TC1 {
- public function __construct() {
- echo "TC1 executed\n";
- }
- public function ReportCollision() {
- echo "TC1 executed\n";
- }
-}
-
-trait TC2 {
- public function __construct() {
- echo "TC2 executed\n";
- }
- public function ReportCollision() {
- echo "TC1 executed\n";
- }
-}
-
-class ReportCollision {
- use TC1, TC2;
-
- public function __construct() {
- echo "New constructor executed\n";
- }
- public function ReportCollision() {
- echo "Legacy constructor executed\n";
- }
-}
-
-
-echo "ReportCollision: ";
-$o = new ReportCollision;
---EXPECT--
-ReportCollision: New constructor executed
diff --git a/Zend/tests/traits/bug55554d.phpt b/Zend/tests/traits/bug55554d.phpt
deleted file mode 100644
index 88564a83c1..0000000000
--- a/Zend/tests/traits/bug55554d.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// Test mixed constructors from different traits, we are more strict about
-// these cases, since that can lead to un-expected behavior.
-// It is not consistent with the normal constructor handling, but
-// here we have a chance to be more strict for the new traits.
-
-trait TNew {
- public function __construct() {
- echo "TNew executed\n";
- }
-}
-
-trait TLegacy {
- public function ReportCollision() {
- echo "ReportCollision executed\n";
- }
-}
-
-class ReportCollision {
- use TNew, TLegacy;
-}
-
-$o = new ReportCollision;
---EXPECTF--
-Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
diff --git a/Zend/tests/traits/bug55554e.phpt b/Zend/tests/traits/bug55554e.phpt
deleted file mode 100644
index ed1c324831..0000000000
--- a/Zend/tests/traits/bug55554e.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// Ensuring that the collision still occurs as expected.
-
-trait TC1 {
- public function ReportCollision() {
- echo "TC1 executed\n";
- }
-}
-
-trait TC2 {
- public function ReportCollision() {
- echo "TC1 executed\n";
- }
-}
-
-class ReportCollision {
- use TC1, TC2;
-}
-
-
-echo "ReportCollision: ";
-$o = new ReportCollision;
---EXPECTF--
-Fatal error: Trait method ReportCollision has not been applied, because there are collisions with other trait methods on ReportCollision in %s on line %d
diff --git a/Zend/tests/traits/bug55554f.phpt b/Zend/tests/traits/bug55554f.phpt
deleted file mode 100644
index d7d4fc007d..0000000000
--- a/Zend/tests/traits/bug55554f.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// Ensuring that inconsistent constructor use results in an error to avoid
-// problems creeping in.
-
-trait TNew {
- public function __construct() {
- echo "TNew executed\n";
- }
-}
-
-class ReportCollision {
- use TNew;
-
- public function ReportCollision() {
- echo "ReportCollision executed\n";
- }
-}
-
-
-echo "ReportCollision: ";
-$o = new ReportCollision;
---EXPECTF--
-Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
diff --git a/Zend/tests/traits/bug55554g.phpt b/Zend/tests/traits/bug55554g.phpt
deleted file mode 100644
index d7de8216b0..0000000000
--- a/Zend/tests/traits/bug55554g.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Bug #55137 (Legacy constructor not registered for class)
---FILE--
-<?php
-
-// Ensuring that inconsistent constructor use results in an error to avoid
-// problems creeping in.
-
-trait TLegacy {
- public function ReportCollision() {
- echo "TLegacy executed\n";
- }
-}
-
-class ReportCollision {
- use TLegacy;
-
- public function __construct() {
- echo "ReportCollision executed\n";
- }
-}
-
-
-echo "ReportCollision: ";
-$o = new ReportCollision;
---EXPECTF--
-Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
diff --git a/Zend/tests/traits/noctor001.phpt b/Zend/tests/traits/noctor001.phpt
deleted file mode 100644
index 19fe8dbd0d..0000000000
--- a/Zend/tests/traits/noctor001.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Don't mark trait methods as constructor
---FILE--
-<?php
-trait Foo {
- public function Foo() {
- }
-}
-
-class Bar {
- use Foo;
- public function Bar() {
- }
-}
-
-$rfoofoo = new ReflectionMethod('Foo::Foo');
-var_dump($rfoofoo->isConstructor());
-
-$rbarfoo = new ReflectionMethod('Bar::Foo');
-var_dump($rbarfoo->isConstructor());
-
-$rbarbar = new ReflectionMethod('Bar::Bar');
-var_dump($rbarbar->isConstructor());
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in %s on line %d
-bool(false)
-bool(false)
-bool(true)
diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt
index 3113bedcf0..d93e70923a 100644
--- a/Zend/tests/type_declarations/callable_001.phpt
+++ b/Zend/tests/type_declarations/callable_001.phpt
@@ -14,19 +14,13 @@ $closure = function () {};
foo("strpos");
foo("foo");
-foo(array("bar", "baz"));
-foo(array("bar", "foo"));
foo($closure);
+foo(array("bar", "foo"));
+foo(array("bar", "baz"));
--EXPECTF--
string(6) "strpos"
string(3) "foo"
-
-Deprecated: Non-static method bar::baz() should not be called statically in %s on line %d
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(3) "baz"
+object(Closure)#1 (0) {
}
array(2) {
[0]=>
@@ -34,5 +28,9 @@ array(2) {
[1]=>
string(3) "foo"
}
-object(Closure)#%d (0) {
-}
+
+Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, array given, called in %s on line %d and defined in %s:%d
+Stack trace:
+#0 %s(%d): foo(Array)
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/iterable_002.phpt b/Zend/tests/type_declarations/iterable_002.phpt
index b9e02e40cd..fdc3b20df5 100644
--- a/Zend/tests/type_declarations/iterable_002.phpt
+++ b/Zend/tests/type_declarations/iterable_002.phpt
@@ -17,4 +17,4 @@ function baz(iterable $iterable = 1) {
?>
--EXPECTF--
-Fatal error: Default value for parameters with iterable type can only be an array or NULL in %s on line %d
+Fatal error: Cannot use int as default value for parameter $iterable of type iterable in %s on line %d
diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable_004.phpt
index 58b3f67f40..fe9d4461b9 100644
--- a/Zend/tests/type_declarations/iterable_004.phpt
+++ b/Zend/tests/type_declarations/iterable_004.phpt
@@ -21,4 +21,4 @@ class Bar extends Foo {
?>
--EXPECTF--
-Warning: Declaration of Bar::testScalar(iterable $iterable) should be compatible with Foo::testScalar(int $int) in %s on line %d
+Fatal error: Declaration of Bar::testScalar(iterable $iterable) must be compatible with Foo::testScalar(int $int) in %s on line %d
diff --git a/Zend/tests/type_declarations/parameter_type_variance.phpt b/Zend/tests/type_declarations/parameter_type_variance.phpt
index 61915a2e6c..e4e5400957 100644
--- a/Zend/tests/type_declarations/parameter_type_variance.phpt
+++ b/Zend/tests/type_declarations/parameter_type_variance.phpt
@@ -1,5 +1,5 @@
--TEST--
-Parameter variance with no type
+Parameter variance with no type (class)
--FILE--
<?php
@@ -8,11 +8,6 @@ class Foo {
function testBothClass(Foo $foo) {}
function testChildClass($foo) {}
function testNoneClass($foo) {}
-
- function testParentBuiltin(int $foo) {}
- function testBothBuiltin(int $foo) {}
- function testChildBuiltin($foo) {}
- function testNoneBuiltin($foo) {}
}
class Bar extends Foo {
@@ -20,15 +15,8 @@ class Bar extends Foo {
function testBothClass(Foo $foo) {}
function testChildClass(Foo $foo) {}
function testNoneClass($foo) {}
-
- function testParentBuiltin($foo) {}
- function testBothBuiltin(int $foo) {}
- function testChildBuiltin(int $foo) {}
- function testNoneBuiltin($foo) {}
}
?>
--EXPECTF--
-Warning: Declaration of Bar::testChildClass(Foo $foo) should be compatible with Foo::testChildClass($foo) in %s on line %d
-
-Warning: Declaration of Bar::testChildBuiltin(int $foo) should be compatible with Foo::testChildBuiltin($foo) in %s on line %d
+Fatal error: Declaration of Bar::testChildClass(Foo $foo) must be compatible with Foo::testChildClass($foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/parameter_type_variance_2.phpt b/Zend/tests/type_declarations/parameter_type_variance_2.phpt
new file mode 100644
index 0000000000..59f10b28f5
--- /dev/null
+++ b/Zend/tests/type_declarations/parameter_type_variance_2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Parameter variance with no type (builtin)
+--FILE--
+<?php
+
+class Foo {
+ function testParentBuiltin(int $foo) {}
+ function testBothBuiltin(int $foo) {}
+ function testChildBuiltin($foo) {}
+ function testNoneBuiltin($foo) {}
+}
+
+class Bar extends Foo {
+ function testParentBuiltin($foo) {}
+ function testBothBuiltin(int $foo) {}
+ function testChildBuiltin(int $foo) {}
+ function testNoneBuiltin($foo) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::testChildBuiltin(int $foo) must be compatible with Foo::testChildBuiltin($foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
index b9076c6b52..88c6a4b39f 100644
--- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt
+++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
@@ -39,6 +39,10 @@ function int_val_default_null(int $a = NULL_VAL) {
return $a;
}
+function nullable_int_val_default_null(?int $a = NULL_VAL) {
+ return $a;
+}
+
echo "Testing int val" . PHP_EOL;
var_dump(int_val());
@@ -58,13 +62,27 @@ echo "Testing string add val" . PHP_EOL;
var_dump(string_add_val());
echo "Testing int with default null constant" . PHP_EOL;
-var_dump(int_val_default_null());
+try {
+ var_dump(int_val_default_null());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Testing int with null null constant" . PHP_EOL;
-var_dump(int_val_default_null(null));
+try {
+ var_dump(int_val_default_null(null));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "Testing nullable int with default null constant" . PHP_EOL;
+var_dump(nullable_int_val_default_null());
+
+echo "Testing nullable int with null null constant" . PHP_EOL;
+var_dump(nullable_int_val_default_null(null));
?>
---EXPECT--
+--EXPECTF--
Testing int val
int(10)
Testing float val
@@ -78,6 +96,10 @@ float(10.7)
Testing string add val
string(14) "this is a test"
Testing int with default null constant
-NULL
+Argument 1 passed to int_val_default_null() must be of the type int, null given, called in %s on line %d
Testing int with null null constant
+Argument 1 passed to int_val_default_null() must be of the type int, null given, called in %s on line %d
+Testing nullable int with default null constant
+NULL
+Testing nullable int with null null constant
NULL
diff --git a/Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt b/Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt
index fd7f96ab95..fc6fc21b17 100644
--- a/Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt
+++ b/Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt
@@ -12,4 +12,4 @@ test();
?>
--EXPECTF--
-Fatal error: Default value for parameters with a float type can only be float, integer, or NULL in %s on line %d
+Fatal error: Cannot use bool as default value for parameter $arg of type float in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt
index 03d9e41aac..2df693aa99 100644
--- a/Zend/tests/type_declarations/typed_properties_004.phpt
+++ b/Zend/tests/type_declarations/typed_properties_004.phpt
@@ -11,8 +11,8 @@ new class("PHP 7 is better than you, and it knows it ...") {
};
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property class@anonymous::$int must be int, string used in %s:6
+Fatal error: Uncaught TypeError: Cannot assign string to property class@anonymous::$int of type int in %s:%d
Stack trace:
-#0 %s(2): class@anonymous->__construct('PHP 7 is better...')
+#0 %s(%d): class@anonymous->__construct('PHP 7 is better...')
#1 {main}
- thrown in %s on line 6
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_005.phpt b/Zend/tests/type_declarations/typed_properties_005.phpt
index b521963000..104f4bd57e 100644
--- a/Zend/tests/type_declarations/typed_properties_005.phpt
+++ b/Zend/tests/type_declarations/typed_properties_005.phpt
@@ -13,8 +13,8 @@ new class(new Dummy) {
};
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property class@anonymous::$std must be an instance of stdClass, Dummy used in %s:8
+Fatal error: Uncaught TypeError: Cannot assign Dummy to property class@anonymous::$std of type stdClass in %s:%d
Stack trace:
-#0 %s(4): class@anonymous->__construct(Object(Dummy))
+#0 %s(%d): class@anonymous->__construct(Object(Dummy))
#1 {main}
- thrown in %s on line 8
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_013.phpt b/Zend/tests/type_declarations/typed_properties_013.phpt
index 01c2f4b6a0..7236e21a2c 100644
--- a/Zend/tests/type_declarations/typed_properties_013.phpt
+++ b/Zend/tests/type_declarations/typed_properties_013.phpt
@@ -7,4 +7,4 @@ class Foo {
}
?>
--EXPECTF--
-Fatal error: Default value for property of type int can only be int in %s on line 3
+Fatal error: Cannot use string as default value for property Foo::$bar of type int in %s on line 3
diff --git a/Zend/tests/type_declarations/typed_properties_014.phpt b/Zend/tests/type_declarations/typed_properties_014.phpt
index 2a02f0381e..f7a4449abd 100644
--- a/Zend/tests/type_declarations/typed_properties_014.phpt
+++ b/Zend/tests/type_declarations/typed_properties_014.phpt
@@ -7,4 +7,4 @@ class Foo {
}
?>
--EXPECTF--
-Fatal error: Default value for property of type array can only be an array in %s on line 3
+Fatal error: Cannot use int as default value for property Foo::$bar of type array in %s on line 3
diff --git a/Zend/tests/type_declarations/typed_properties_020.phpt b/Zend/tests/type_declarations/typed_properties_020.phpt
index d32d17b1c8..3b16a9d81d 100644
--- a/Zend/tests/type_declarations/typed_properties_020.phpt
+++ b/Zend/tests/type_declarations/typed_properties_020.phpt
@@ -22,5 +22,5 @@ $foo = new Foo();
var_dump($foo->bar);
?>
--EXPECT--
-Typed property Foo::$bar must be int, float used
+Cannot assign float to property Foo::$bar of type int
int(2)
diff --git a/Zend/tests/type_declarations/typed_properties_029.phpt b/Zend/tests/type_declarations/typed_properties_029.phpt
index a5418c91a8..9beca10627 100644
--- a/Zend/tests/type_declarations/typed_properties_029.phpt
+++ b/Zend/tests/type_declarations/typed_properties_029.phpt
@@ -12,7 +12,7 @@ $foo = new Foo;
$foo->bar = "1";
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, string used in %s:9
+Fatal error: Uncaught TypeError: Cannot assign string to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 9
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_030.phpt b/Zend/tests/type_declarations/typed_properties_030.phpt
index a835ae5fae..8feda02316 100644
--- a/Zend/tests/type_declarations/typed_properties_030.phpt
+++ b/Zend/tests/type_declarations/typed_properties_030.phpt
@@ -19,7 +19,7 @@ unset($foo->bar); # ok
var_dump($foo->bar); # not okay, __get is nasty
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, string used in %s:16
+Fatal error: Uncaught TypeError: Cannot assign string to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 16
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt
index c3885af39f..79317553ab 100644
--- a/Zend/tests/type_declarations/typed_properties_034.phpt
+++ b/Zend/tests/type_declarations/typed_properties_034.phpt
@@ -38,7 +38,7 @@ var_dump($foo);
?>
--EXPECT--
int(42)
-Typed property class@anonymous::$baz must be int, null used
+Cannot assign null to property class@anonymous::$baz of type int
int(1)
int(10)
int(10)
diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt
index 44e5d04c7f..94a00d0d8c 100644
--- a/Zend/tests/type_declarations/typed_properties_038.phpt
+++ b/Zend/tests/type_declarations/typed_properties_038.phpt
@@ -44,7 +44,7 @@ object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
@@ -54,7 +54,7 @@ object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
diff --git a/Zend/tests/type_declarations/typed_properties_039.phpt b/Zend/tests/type_declarations/typed_properties_039.phpt
index 62413d804c..47ae17f0ab 100644
--- a/Zend/tests/type_declarations/typed_properties_039.phpt
+++ b/Zend/tests/type_declarations/typed_properties_039.phpt
@@ -25,7 +25,7 @@ var_dump($objs);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property A::$foo must be int, A used in %s:%d
+Fatal error: Uncaught TypeError: Cannot assign A to property A::$foo of type int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_040.phpt b/Zend/tests/type_declarations/typed_properties_040.phpt
index db2b90903c..0b47c92a87 100644
--- a/Zend/tests/type_declarations/typed_properties_040.phpt
+++ b/Zend/tests/type_declarations/typed_properties_040.phpt
@@ -19,7 +19,7 @@ var_dump($foo->bar);
--EXPECTF--
string(3) "bar"
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, null used in %s:14
+Fatal error: Uncaught TypeError: Cannot assign null to property Foo::$bar of type int in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 14
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_046.phpt b/Zend/tests/type_declarations/typed_properties_046.phpt
index 050e64a2a4..d95fe8dc24 100644
--- a/Zend/tests/type_declarations/typed_properties_046.phpt
+++ b/Zend/tests/type_declarations/typed_properties_046.phpt
@@ -22,8 +22,8 @@ for ($i = 0; $i < 5; $i++) {
}
}
--EXPECT--
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
-Typed property Foo::$bbb must be int, string used
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
+Cannot assign string to property Foo::$bbb of type int
diff --git a/Zend/tests/type_declarations/typed_properties_047.phpt b/Zend/tests/type_declarations/typed_properties_047.phpt
index 0b48cd1cd4..db78143b02 100644
--- a/Zend/tests/type_declarations/typed_properties_047.phpt
+++ b/Zend/tests/type_declarations/typed_properties_047.phpt
@@ -37,4 +37,4 @@ NULL
int(5)
NULL
Typed property Foo::$foo must not be accessed before initialization
-Typed property Foo::$foo must be int or null, string used
+Cannot assign string to property Foo::$foo of type ?int
diff --git a/Zend/tests/type_declarations/typed_properties_051.phpt b/Zend/tests/type_declarations/typed_properties_051.phpt
index 1c8673d0d3..977570b238 100644
--- a/Zend/tests/type_declarations/typed_properties_051.phpt
+++ b/Zend/tests/type_declarations/typed_properties_051.phpt
@@ -24,4 +24,4 @@ try {
?>
--EXPECT--
string(4) "okok"
-Typed property A::$a must be string, C used
+Cannot assign C to property A::$a of type string
diff --git a/Zend/tests/type_declarations/typed_properties_054.phpt b/Zend/tests/type_declarations/typed_properties_054.phpt
index 38de9815ed..cb771d6e64 100644
--- a/Zend/tests/type_declarations/typed_properties_054.phpt
+++ b/Zend/tests/type_declarations/typed_properties_054.phpt
@@ -9,4 +9,4 @@ $obj = new A;
var_dump($obj);
?>
--EXPECTF--
-Fatal error: Property A::$a cannot have type callable in %s on line %d
+Fatal error: Property A::$a cannot have type ?callable in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt
index 54013f44f2..4d2930cc3b 100644
--- a/Zend/tests/type_declarations/typed_properties_056.phpt
+++ b/Zend/tests/type_declarations/typed_properties_056.phpt
@@ -19,5 +19,5 @@ var_dump($o->foo);
unset($o);
?>
--EXPECT--
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
diff --git a/Zend/tests/type_declarations/typed_properties_057.phpt b/Zend/tests/type_declarations/typed_properties_057.phpt
index 6b53a42600..ebec0f48bf 100644
--- a/Zend/tests/type_declarations/typed_properties_057.phpt
+++ b/Zend/tests/type_declarations/typed_properties_057.phpt
@@ -25,7 +25,7 @@ var_dump($o->foo);
unset($o);
?>
--EXPECT--
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
-Typed property A::$foo must be string, int used
+Cannot assign int to property A::$foo of type string
string(3) "100"
diff --git a/Zend/tests/type_declarations/typed_properties_058.phpt b/Zend/tests/type_declarations/typed_properties_058.phpt
index d9283bdbef..a6d65daa4c 100644
--- a/Zend/tests/type_declarations/typed_properties_058.phpt
+++ b/Zend/tests/type_declarations/typed_properties_058.phpt
@@ -28,5 +28,5 @@ for ($i = 0; $i < 2; $i++) {
?>
--EXPECT--
int(5)
-Typed property B::$foo must be string, int used
-Typed property B::$foo must be string, int used
+Cannot assign int to property B::$foo of type string
+Cannot assign int to property B::$foo of type string
diff --git a/Zend/tests/type_declarations/typed_properties_060.phpt b/Zend/tests/type_declarations/typed_properties_060.phpt
index 559349b7a9..5b3c9d0981 100644
--- a/Zend/tests/type_declarations/typed_properties_060.phpt
+++ b/Zend/tests/type_declarations/typed_properties_060.phpt
@@ -16,7 +16,7 @@ $o->a = "a";
--EXPECTF--
int(1)
-Fatal error: Uncaught TypeError: Typed property A::$a must be int, string used in %s:%d
+Fatal error: Uncaught TypeError: Cannot assign string to property A::$a of type int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_068.phpt b/Zend/tests/type_declarations/typed_properties_068.phpt
index 7ed58d2a00..dc5cb1b5ff 100644
--- a/Zend/tests/type_declarations/typed_properties_068.phpt
+++ b/Zend/tests/type_declarations/typed_properties_068.phpt
@@ -69,14 +69,14 @@ int(4)
Cannot assign null to reference held by property Foo::$i of type int
int(4)
int(4)
-Typed property Foo::$i must be int, null used
+Cannot assign null to property Foo::$i of type int
int(4)
int(4)
string(1) "5"
string(1) "5"
int(0)
int(0)
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
int(0)
string(1) "x"
Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int
diff --git a/Zend/tests/type_declarations/typed_properties_069.phpt b/Zend/tests/type_declarations/typed_properties_069.phpt
index 77cfc02487..0f804f8f06 100644
--- a/Zend/tests/type_declarations/typed_properties_069.phpt
+++ b/Zend/tests/type_declarations/typed_properties_069.phpt
@@ -22,6 +22,6 @@ var_dump(nonNumericStringRef());
?>
--EXPECT--
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
Typed static property Foo::$i must not be accessed before initialization
string(1) "x"
diff --git a/Zend/tests/type_declarations/typed_properties_070.phpt b/Zend/tests/type_declarations/typed_properties_070.phpt
index dd77c68355..ec2d6bf8c6 100644
--- a/Zend/tests/type_declarations/typed_properties_070.phpt
+++ b/Zend/tests/type_declarations/typed_properties_070.phpt
@@ -43,7 +43,7 @@ string(2) "11"
string(2) "13"
string(2) "12"
int(1)
-Typed property Foo::$i must be int, float used
+Cannot assign float to property Foo::$i of type int
int(1)
-Typed property Foo::$i must be int, string used
+Cannot assign string to property Foo::$i of type int
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_074.phpt b/Zend/tests/type_declarations/typed_properties_074.phpt
index 8e6be312c6..5a84435550 100644
--- a/Zend/tests/type_declarations/typed_properties_074.phpt
+++ b/Zend/tests/type_declarations/typed_properties_074.phpt
@@ -31,7 +31,7 @@ object(Test)#1 (1) {
["val"]=>
uninitialized(int)
}
-Typed property Test::$val must be int, string used
+Cannot assign string to property Test::$val of type int
object(Test)#1 (1) {
["prop"]=>
&string(1) "x"
diff --git a/Zend/tests/type_declarations/typed_properties_075.phpt b/Zend/tests/type_declarations/typed_properties_075.phpt
index 5f3943cbee..def86f3695 100644
--- a/Zend/tests/type_declarations/typed_properties_075.phpt
+++ b/Zend/tests/type_declarations/typed_properties_075.phpt
@@ -45,9 +45,9 @@ var_dump(Foo::$bar);
--EXPECT--
string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
int(9223372036854775807)
-string(48) "Typed property Foo::$bar must be int, float used"
+string(53) "Cannot assign float to property Foo::$bar of type int"
int(9223372036854775807)
string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
int(9223372036854775807)
-string(48) "Typed property Foo::$bar must be int, float used"
+string(53) "Cannot assign float to property Foo::$bar of type int"
int(9223372036854775807)
diff --git a/Zend/tests/type_declarations/typed_properties_078.phpt b/Zend/tests/type_declarations/typed_properties_078.phpt
index 6645970dd4..d8fc67d466 100644
--- a/Zend/tests/type_declarations/typed_properties_078.phpt
+++ b/Zend/tests/type_declarations/typed_properties_078.phpt
@@ -45,7 +45,7 @@ var_dump($ref instanceof ArrayIterator);
--EXPECT--
array(0) {
}
-string(89) "Typed property class@anonymous::$t must be an instance of Traversable or null, array used"
+string(72) "Cannot assign array to property class@anonymous::$t of type ?Traversable"
array(0) {
}
array(1) {
diff --git a/Zend/tests/type_declarations/typed_properties_091.phpt b/Zend/tests/type_declarations/typed_properties_091.phpt
deleted file mode 100644
index 2083086086..0000000000
--- a/Zend/tests/type_declarations/typed_properties_091.phpt
+++ /dev/null
@@ -1,203 +0,0 @@
---TEST--
-Automatic promotion of falsy to object
---FILE--
-<?php
-
-class Test {
- public ?Test $prop;
- public ?stdClass $stdProp;
- public ?object $objectProp;
-
- public static ?Test $staticProp = null;
- public static ?stdClass $staticStdProp = null;
- public static ?object $staticObjectProp = null;
-}
-
-// Object properties
-$test = new Test;
-try {
- $test->prop->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-$test->stdProp->wat = 123;
-$test->objectProp->wat = 123;
-var_dump($test);
-
-// Object properties via reference
-$test = new Test;
-$prop =& $test->prop;
-$stdProp =& $test->stdProp;
-$objectProp =& $test->objectProp;
-try {
- $prop->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-$stdProp->wat = 123;
-$objectProp->wat = 123;
-var_dump($test);
-
-// Object properties via reference rw
-$test = new Test;
-$prop =& $test->prop;
-$stdProp =& $test->stdProp;
-$objectProp =& $test->objectProp;
-try {
- $prop->wat->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-$stdProp->wat->wat = 123;
-$objectProp->wat->wat = 123;
-var_dump($test);
-
-// Static properties
-try {
- Test::$staticProp->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-Test::$staticStdProp->wat = 123;
-Test::$staticObjectProp->wat = 123;
-var_dump(Test::$staticProp, Test::$staticStdProp, Test::$staticObjectProp);
-
-// Non-string property name
-$test = new Test;
-$propName = new class {
- public function __toString() {
- return 'prop';
- }
-};
-try {
- $test->$propName->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-var_dump($test);
-
-// Initially null
-$test = new Test;
-$test->prop = NULL;
-$test->stdProp = NULL;
-$test->objectProp = NULL;
-try {
- $test->prop->wat = 123;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
-}
-$test->stdProp->wat = 123;
-$test->objectProp->wat = 123;
-var_dump($test);
-
-?>
---EXPECTF--
-Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-object(Test)#1 (2) {
- ["prop"]=>
- uninitialized(?Test)
- ["stdProp"]=>
- object(stdClass)#3 (1) {
- ["wat"]=>
- int(123)
- }
- ["objectProp"]=>
- object(stdClass)#4 (1) {
- ["wat"]=>
- int(123)
- }
-}
-Cannot auto-initialize an stdClass inside a reference held by property Test::$prop of type ?Test
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-object(Test)#5 (3) {
- ["prop"]=>
- &NULL
- ["stdProp"]=>
- &object(stdClass)#2 (1) {
- ["wat"]=>
- int(123)
- }
- ["objectProp"]=>
- &object(stdClass)#4 (1) {
- ["wat"]=>
- int(123)
- }
-}
-Cannot auto-initialize an stdClass inside a reference held by property Test::$prop of type ?Test
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-object(Test)#3 (3) {
- ["prop"]=>
- &NULL
- ["stdProp"]=>
- &object(stdClass)#1 (1) {
- ["wat"]=>
- object(stdClass)#2 (1) {
- ["wat"]=>
- int(123)
- }
- }
- ["objectProp"]=>
- &object(stdClass)#5 (1) {
- ["wat"]=>
- object(stdClass)#6 (1) {
- ["wat"]=>
- int(123)
- }
- }
-}
-Cannot auto-initialize an stdClass inside property Test::$staticProp of type ?Test
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-NULL
-object(stdClass)#4 (1) {
- ["wat"]=>
- int(123)
-}
-object(stdClass)#8 (1) {
- ["wat"]=>
- int(123)
-}
-Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
-object(Test)#9 (0) {
- ["prop"]=>
- uninitialized(?Test)
- ["stdProp"]=>
- uninitialized(?stdClass)
- ["objectProp"]=>
- uninitialized(?object)
-}
-Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-object(Test)#7 (3) {
- ["prop"]=>
- NULL
- ["stdProp"]=>
- object(stdClass)#10 (1) {
- ["wat"]=>
- int(123)
- }
- ["objectProp"]=>
- object(stdClass)#11 (1) {
- ["wat"]=>
- int(123)
- }
-}
diff --git a/Zend/tests/type_declarations/typed_properties_093.phpt b/Zend/tests/type_declarations/typed_properties_093.phpt
index f0c7ef51a9..1f4bf4cb8c 100644
--- a/Zend/tests/type_declarations/typed_properties_093.phpt
+++ b/Zend/tests/type_declarations/typed_properties_093.phpt
@@ -24,7 +24,7 @@ var_dump($test);
?>
--EXPECT--
-Typed property Test::$prop must be int, string used
+Cannot assign string to property Test::$prop of type int
object(Test)#2 (0) {
["prop"]=>
uninitialized(int)
diff --git a/Zend/tests/type_declarations/typed_properties_095.phpt b/Zend/tests/type_declarations/typed_properties_095.phpt
index edbef8dfc7..3f1027f08f 100644
--- a/Zend/tests/type_declarations/typed_properties_095.phpt
+++ b/Zend/tests/type_declarations/typed_properties_095.phpt
@@ -60,8 +60,8 @@ var_dump(_ZendTestClass::$staticIntProp);
?>
--EXPECT--
int(123)
-Typed property _ZendTestClass::$intProp must be int, string used
-Typed property _ZendTestClass::$classProp must be an instance of stdClass or null, _ZendTestClass used
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass
object(_ZendTestClass)#1 (2) {
["intProp"]=>
int(456)
@@ -70,8 +70,8 @@ object(_ZendTestClass)#1 (2) {
}
}
int(123)
-Typed property _ZendTestClass::$intProp must be int, string used
-Typed property _ZendTestClass::$classProp must be an instance of stdClass or null, Test used
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass
object(Test)#4 (2) {
["intProp"]=>
int(456)
@@ -80,5 +80,5 @@ object(Test)#4 (2) {
}
}
int(123)
-Typed property _ZendTestClass::$staticIntProp must be int, string used
+Cannot assign string to property _ZendTestClass::$staticIntProp of type int
int(456)
diff --git a/Zend/tests/type_declarations/typed_properties_096.phpt b/Zend/tests/type_declarations/typed_properties_096.phpt
index 32191b241e..83f086d345 100644
--- a/Zend/tests/type_declarations/typed_properties_096.phpt
+++ b/Zend/tests/type_declarations/typed_properties_096.phpt
@@ -31,7 +31,7 @@ var_dump($test);
?>
--EXPECT--
-Typed property Test1::$prop must be an instance of Foobar, int used
+Cannot assign int to property Test1::$prop of type Foobar
object(Test1)#1 (1) {
["prop"]=>
uninitialized(Foobar)
diff --git a/Zend/tests/type_declarations/typed_properties_103.phpt b/Zend/tests/type_declarations/typed_properties_103.phpt
index 5c0fc85a99..f3f70bfa62 100644
--- a/Zend/tests/type_declarations/typed_properties_103.phpt
+++ b/Zend/tests/type_declarations/typed_properties_103.phpt
@@ -15,7 +15,7 @@ function foo() {
foo();
?>
--EXPECTF--
-Notice: Undefined property: C::$a in %s on line %d
+Warning: Undefined property: C::$a in %s on line %d
object(C)#1 (1) {
["a"]=>
int(2)
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt b/Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt
index 48d2e0b956..4cb4d655d6 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt
@@ -24,4 +24,4 @@ $c = new C;
?>
--EXPECTF--
-Warning: Declaration of B::method(C $x) should be compatible with A::method(B $x) in %s on line %d
+Fatal error: Declaration of B::method(C $x) must be compatible with A::method(B $x) in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt b/Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt
index a6a46f84a2..ef7032e4a0 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt
@@ -41,12 +41,4 @@ object(A)#2 (0) {
object(X)#2 (0) {
}
-Warning: Declaration of Y::method(Z $a) should be compatible with X::method(Y $a) in %s on line %d
-object(Z)#2 (0) {
-}
-object(Y)#2 (0) {
-}
-object(B)#2 (0) {
-}
-object(B)#2 (0) {
-}
+Fatal error: Declaration of Y::method(Z $a) must be compatible with X::method(Y $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/parent_in_class.phpt b/Zend/tests/type_declarations/variance/parent_in_class.phpt
deleted file mode 100644
index c65146676d..0000000000
--- a/Zend/tests/type_declarations/variance/parent_in_class.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-Use of parent inside a class that has / has no parent
---FILE--
-<?php
-
-// Illegal: A::parent is ill-defined
-class A {
- public function method(parent $x) {}
-}
-class B extends A {
- public function method(parent $x) {}
-}
-
-// Legal: A2::parent == P2
-class P2 {}
-class A2 extends P2 {
- public function method(parent $x) {}
-}
-class B2 extends A2 {
- public function method(P2 $x) {}
-}
-
-// Legal: B3::parent == A3 is subclass of A3::parent == P3 in covariant position
-class P3 {}
-class A3 extends P3 {
- public function method($x): parent {}
-}
-class B3 extends A3 {
- public function method($x): parent {}
-}
-
-// Illegal: B4::parent == A4 is subclass of A4::parent == P4 in contravariant position
-class P4 {}
-class A4 extends P4 {
- public function method(parent $x) {}
-}
-class B4 extends A4 {
- public function method(parent $x) {}
-}
-
-?>
---EXPECTF--
-Deprecated: Cannot use "parent" when current class scope has no parent in %s on line %d
-
-Warning: Declaration of B4::method(A4 $x) should be compatible with A4::method(P4 $x) in %s on line %d
-
-Warning: Could not check compatibility between B::method(A $x) and A::method(parent $x), because class parent is not available in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/parent_in_class_failure1.phpt b/Zend/tests/type_declarations/variance/parent_in_class_failure1.phpt
new file mode 100644
index 0000000000..6bbf4881a8
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/parent_in_class_failure1.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Use of parent inside a class that has / has no parent (failure case 1)
+--FILE--
+<?php
+
+// Illegal: A::parent is ill-defined
+class A {
+ public function method(parent $x) {}
+}
+class B extends A {
+ public function method(parent $x) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "parent" when current class scope has no parent in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/parent_in_class_failure2.phpt b/Zend/tests/type_declarations/variance/parent_in_class_failure2.phpt
new file mode 100644
index 0000000000..f9902d8073
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/parent_in_class_failure2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Use of parent inside a class that has / has no parent (failure case 2)
+--FILE--
+<?php
+
+// Illegal: B4::parent == A4 is subclass of A4::parent == P4 in contravariant position
+class P4 {}
+class A4 extends P4 {
+ public function method(parent $x) {}
+}
+class B4 extends A4 {
+ public function method(parent $x) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B4::method(A4 $x) must be compatible with A4::method(P4 $x) in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/parent_in_class_success.phpt b/Zend/tests/type_declarations/variance/parent_in_class_success.phpt
new file mode 100644
index 0000000000..c3edceaf3b
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/parent_in_class_success.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Use of parent inside a class that has / has no parent (success cases)
+--FILE--
+<?php
+
+// Legal: A2::parent == P2
+class P2 {}
+class A2 extends P2 {
+ public function method(parent $x) {}
+}
+class B2 extends A2 {
+ public function method(P2 $x) {}
+}
+
+// Legal: B3::parent == A3 is subclass of A3::parent == P3 in covariant position
+class P3 {}
+class A3 extends P3 {
+ public function method($x): parent {}
+}
+class B3 extends A3 {
+ public function method($x): parent {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/unset_cast_deprecated.phpt b/Zend/tests/unset_cast_deprecated.phpt
deleted file mode 100644
index 6744c85f02..0000000000
--- a/Zend/tests/unset_cast_deprecated.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-The (unset) cast is deprecated
---FILE--
-<?php
-
-$x = 1;
-var_dump((unset) $x);
-var_dump($x);
-
-?>
---EXPECTF--
-Deprecated: The (unset) cast is deprecated in %s on line %d
-NULL
-int(1)
diff --git a/Zend/tests/unset_cast_removed.phpt b/Zend/tests/unset_cast_removed.phpt
new file mode 100644
index 0000000000..9f2f798ed0
--- /dev/null
+++ b/Zend/tests/unset_cast_removed.phpt
@@ -0,0 +1,12 @@
+--TEST--
+The (unset) cast is removed
+--FILE--
+<?php
+
+$x = 1;
+var_dump((unset) $x);
+var_dump($x);
+
+?>
+--EXPECTF--
+Fatal error: The (unset) cast is no longer supported in %s on line %d
diff --git a/Zend/tests/unset_cv01.phpt b/Zend/tests/unset_cv01.phpt
index 99af118d10..508a0cbf3e 100644
--- a/Zend/tests/unset_cv01.phpt
+++ b/Zend/tests/unset_cv01.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv01.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv02.phpt b/Zend/tests/unset_cv02.phpt
index cb2475350c..915b165eca 100644
--- a/Zend/tests/unset_cv02.phpt
+++ b/Zend/tests/unset_cv02.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv02.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv03.phpt b/Zend/tests/unset_cv03.phpt
index 221abe2d88..dce3fce5f1 100644
--- a/Zend/tests/unset_cv03.phpt
+++ b/Zend/tests/unset_cv03.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv03.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv04.phpt b/Zend/tests/unset_cv04.phpt
index 5044cb1c8d..816a5f9ce4 100644
--- a/Zend/tests/unset_cv04.phpt
+++ b/Zend/tests/unset_cv04.phpt
@@ -13,4 +13,4 @@ f();
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv04.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv05.phpt b/Zend/tests/unset_cv05.phpt
index 073ee4bee4..a389d651ad 100644
--- a/Zend/tests/unset_cv05.phpt
+++ b/Zend/tests/unset_cv05.phpt
@@ -17,6 +17,6 @@ echo $_SESSION;
echo "\nok\n";
?>
--EXPECTF--
-Notice: Array to string conversion in %sunset_cv05.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
ok
diff --git a/Zend/tests/unset_cv09.phpt b/Zend/tests/unset_cv09.phpt
index a5407ad64e..a52062575c 100644
--- a/Zend/tests/unset_cv09.phpt
+++ b/Zend/tests/unset_cv09.phpt
@@ -10,5 +10,5 @@ echo "ok\n";
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv09.php on line %d
+Warning: Undefined variable: x in %s on line %d
ok
diff --git a/Zend/tests/unset_cv10.phpt b/Zend/tests/unset_cv10.phpt
index 335463b0ca..97a79bb973 100644
--- a/Zend/tests/unset_cv10.phpt
+++ b/Zend/tests/unset_cv10.phpt
@@ -12,5 +12,5 @@ echo "ok\n";
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv10.php on line %d
+Warning: Undefined variable: x in %s on line %d
ok
diff --git a/Zend/tests/varSyntax/propertyOfStringError.phpt b/Zend/tests/varSyntax/propertyOfStringError.phpt
index 4fa50e7df0..446f1372cd 100644
--- a/Zend/tests/varSyntax/propertyOfStringError.phpt
+++ b/Zend/tests/varSyntax/propertyOfStringError.phpt
@@ -7,4 +7,4 @@ Cannot take property of a string
?>
--EXPECTF--
-Notice: Trying to get property 'bar' of non-object in %s on line %d
+Warning: Trying to get property 'bar' of non-object in %s on line %d
diff --git a/Zend/tests/warning_during_heredoc_scan_ahead.phpt b/Zend/tests/warning_during_heredoc_scan_ahead.phpt
index 099d1c087f..125c392d9d 100644
--- a/Zend/tests/warning_during_heredoc_scan_ahead.phpt
+++ b/Zend/tests/warning_during_heredoc_scan_ahead.phpt
@@ -4,15 +4,12 @@ No warnings should be thrown during heredoc scan-ahead
<?php
<<<TEST
-${x}
\400
${/*}
TEST;
?>
--EXPECTF--
-Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
-
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Unterminated comment starting line %d in %s on line %d
diff --git a/Zend/zend.c b/Zend/zend.c
index af4ac2981c..ce98f50025 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -94,7 +94,7 @@ ZEND_API zend_bool zend_rc_debug = 0;
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
{
if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
+ EG(error_reporting) = E_ALL;
} else {
EG(error_reporting) = atoi(ZSTR_VAL(new_value));
}
@@ -1142,7 +1142,7 @@ ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ *
}
/* }}} */
-ZEND_API char *get_zend_version(void) /* {{{ */
+ZEND_API const char *get_zend_version(void) /* {{{ */
{
return zend_version_info;
}
@@ -1246,19 +1246,19 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
} while (0)
static ZEND_COLD void zend_error_va_list(
- int type, const char *error_filename, uint32_t error_lineno,
+ int orig_type, const char *error_filename, uint32_t error_lineno,
const char *format, va_list args)
{
va_list usr_copy;
- zval params[5];
+ zval params[4];
zval retval;
zval orig_user_error_handler;
zend_bool in_compilation;
zend_class_entry *saved_class_entry;
zend_stack loop_var_stack;
zend_stack delayed_oplines_stack;
- zend_array *symbol_table;
zend_class_entry *orig_fake_scope;
+ int type = orig_type & E_ALL;
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
@@ -1305,7 +1305,7 @@ static ZEND_COLD void zend_error_va_list(
if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
|| !(EG(user_error_handler_error_reporting) & type)
|| EG(error_handling) != EH_NORMAL) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
} else switch (type) {
case E_ERROR:
case E_PARSE:
@@ -1314,7 +1314,7 @@ static ZEND_COLD void zend_error_va_list(
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
/* The error may not be safe to handle in user-space */
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
break;
default:
/* Handle the error in user space */
@@ -1332,15 +1332,6 @@ static ZEND_COLD void zend_error_va_list(
ZVAL_LONG(&params[3], error_lineno);
- symbol_table = zend_rebuild_symbol_table();
-
- /* during shutdown the symbol table table can be still null */
- if (!symbol_table) {
- ZVAL_NULL(&params[4]);
- } else {
- ZVAL_ARR(&params[4], zend_array_dup(symbol_table));
- }
-
ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
ZVAL_UNDEF(&EG(user_error_handler));
@@ -1361,16 +1352,16 @@ static ZEND_COLD void zend_error_va_list(
orig_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
- if (call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params) == SUCCESS) {
+ if (call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 4, params) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
if (Z_TYPE(retval) == IS_FALSE) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
}
zval_ptr_dtor(&retval);
}
} else if (!EG(exception)) {
/* The user error handler failed, use built-in error handler */
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
}
EG(fake_scope) = orig_fake_scope;
@@ -1382,7 +1373,6 @@ static ZEND_COLD void zend_error_va_list(
CG(in_compilation) = 1;
}
- zval_ptr_dtor(&params[4]);
zval_ptr_dtor(&params[2]);
zval_ptr_dtor(&params[1]);
@@ -1558,37 +1548,28 @@ ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */
va_end(va);
} /* }}} */
-ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */
+ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
- if (throw_exception) {
- zend_throw_exception(zend_ce_type_error, message, 0);
- } else {
- zend_error(E_WARNING, "%s", message);
- }
+ zend_throw_exception(zend_ce_argument_count_error, message, 0);
efree(message);
va_end(va);
} /* }}} */
-ZEND_API ZEND_COLD void zend_internal_argument_count_error(zend_bool throw_exception, const char *format, ...) /* {{{ */
+ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
- if (throw_exception) {
- zend_throw_exception(zend_ce_argument_count_error, message, 0);
- } else {
- zend_error(E_WARNING, "%s", message);
- }
+ zend_throw_exception(zend_ce_value_error, message, 0);
efree(message);
-
va_end(va);
} /* }}} */
@@ -1646,9 +1627,10 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /
int i;
zend_file_handle *file_handle;
zend_op_array *op_array;
+ int ret = SUCCESS;
va_start(files, file_count);
- for (i = 0; i < file_count; i++) {
+ for (i = 0; i < file_count && ret != FAILURE; i++) {
file_handle = va_arg(files, zend_file_handle *);
if (!file_handle) {
continue;
@@ -1668,18 +1650,18 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /
}
if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR);
+ ret = FAILURE;
}
}
destroy_op_array(op_array);
efree_size(op_array, sizeof(zend_op_array));
} else if (type==ZEND_REQUIRE) {
- va_end(files);
- return FAILURE;
+ ret = FAILURE;
}
}
va_end(files);
- return SUCCESS;
+ return ret;
}
/* }}} */
diff --git a/Zend/zend.h b/Zend/zend.h
index 6b8c1d0be4..b965a765e3 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
-#define ZEND_VERSION "3.4.0-dev"
+#define ZEND_VERSION "4.0.0-dev"
#define ZEND_ENGINE_3
@@ -244,7 +244,7 @@ ZEND_API zend_string *zend_strpprintf(size_t max_len, const char *format, ...) Z
ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const char *format, ...);
ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...);
-ZEND_API char *get_zend_version(void);
+ZEND_API const char *get_zend_version(void);
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy);
ZEND_API size_t zend_print_zval(zval *expr, int indent);
ZEND_API void zend_print_zval_r(zval *expr, int indent);
@@ -300,8 +300,8 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, const cha
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
-ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
-ZEND_API ZEND_COLD void zend_internal_argument_count_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
+ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
ZEND_COLD void zenderror(const char *error);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 8fab994297..b32c82a1b9 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -90,12 +90,12 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_argument_count_error(ZEND_ARG_USES_STRICT_TYPES(), "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
+ zend_argument_count_error("Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
}
/* }}} */
/* Argument parsing API -- andrei */
-ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
+ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
{
switch(type) {
case IS_FALSE:
@@ -130,7 +130,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
}
/* }}} */
-ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
+ZEND_API const char *zend_zval_type_name(const zval *arg) /* {{{ */
{
ZVAL_DEREF(arg);
return zend_get_type_by_const(Z_TYPE_P(arg));
@@ -173,28 +173,7 @@ ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* {
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_internal_argument_count_error(
- ZEND_ARG_USES_STRICT_TYPES(),
- "%s%s%s() expects %s %d parameter%s, %d given",
- class_name, \
- class_name[0] ? "::" : "", \
- ZSTR_VAL(active_function->common.function_name),
- "exactly",
- 0,
- "s",
- num_args);
- return FAILURE;
-}
-/* }}} */
-
-ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(void) /* {{{ */
-{
- int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data));
- zend_function *active_function = EG(current_execute_data)->func;
- const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
-
- zend_internal_argument_count_error(
- 1,
+ zend_argument_count_error(
"%s%s%s() expects %s %d parameter%s, %d given",
class_name, \
class_name[0] ? "::" : "", \
@@ -213,27 +192,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_internal_argument_count_error(
- ZEND_ARG_USES_STRICT_TYPES(),
- "%s%s%s() expects %s %d parameter%s, %d given",
- class_name, \
- class_name[0] ? "::" : "", \
- ZSTR_VAL(active_function->common.function_name),
- min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
- num_args < min_num_args ? min_num_args : max_num_args,
- (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
- num_args);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception(int min_num_args, int max_num_args) /* {{{ */
-{
- int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data));
- zend_function *active_function = EG(current_execute_data)->func;
- const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
-
- zend_internal_argument_count_error(
- 1,
+ zend_argument_count_error(
"%s%s%s() expects %s %d parameter%s, %d given",
class_name, \
class_name[0] ? "::" : "", \
@@ -258,44 +217,12 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, z
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
- class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int num, zend_expected_type expected_type, zval *arg) /* {{{ */
-{
- const char *space;
- const char *class_name;
- static const char * const expected_error[] = {
- Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
- NULL
- };
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
}
/* }}} */
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg) /* {{{ */
-{
- const char *space;
- const char *class_name;
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
- class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg));
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg) /* {{{ */
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg) /* {{{ */
{
const char *space;
const char *class_name;
@@ -304,7 +231,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int n
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg));
}
/* }}} */
@@ -318,33 +245,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *e
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid callback, %s",
- class_name, space, get_active_function_name(), num, error);
- efree(error);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error) /* {{{ */
-{
- const char *space;
- const char *class_name;
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be a valid callback, %s",
- class_name, space, get_active_function_name(), num, error);
- efree(error);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error) /* {{{ */
-{
- const char *space;
- const char *class_name = get_active_class_name(&space);
-
- zend_error(E_DEPRECATED, "%s%s%s() expects parameter %d to be a valid callback, %s",
+ zend_type_error("%s%s%s() expects parameter %d to be a valid callback, %s",
class_name, space, get_active_function_name(), num, error);
efree(error);
}
@@ -369,7 +270,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
+ zend_type_error("%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
class_name, space, get_active_function_name(), num,
ZSTR_VAL(ce_base->name), Z_STRVAL_P(arg));
*pce = NULL;
@@ -380,7 +281,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
+ zend_type_error("%s%s%s() expects parameter %d to be a valid class name, '%s' given",
class_name, space, get_active_function_name(), num,
Z_STRVAL_P(arg));
return 0;
@@ -461,50 +362,6 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest)
}
/* }}} */
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest) /* {{{ */
-{
- if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
- if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(Z_DVAL_P(arg));
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
- double d;
- int type;
-
- if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
- if (EXPECTED(type != 0)) {
- if (UNEXPECTED(zend_isnan(d))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(d);
- } else {
- return 0;
- }
- }
- if (UNEXPECTED(EG(exception))) {
- return 0;
- }
- } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
- *dest = 0;
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
- *dest = 1;
- } else {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest) /* {{{ */
-{
- if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
- return 0;
- }
- return zend_parse_arg_long_cap_weak(arg, dest);
-}
-/* }}} */
-
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
@@ -546,36 +403,52 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /
}
/* }}} */
+ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */
+{
+ if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
+ return 0;
+ }
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ zend_string *str = Z_STR_P(arg);
+ zend_long lval;
+ double dval;
+ zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, -1);
+ if (type == IS_LONG) {
+ ZVAL_LONG(arg, lval);
+ } else if (type == IS_DOUBLE) {
+ ZVAL_DOUBLE(arg, dval);
+ } else {
+ return 0;
+ }
+ zend_string_release(str);
+ } else if (Z_TYPE_P(arg) < IS_TRUE) {
+ ZVAL_LONG(arg, 0);
+ } else if (Z_TYPE_P(arg) == IS_TRUE) {
+ ZVAL_LONG(arg, 1);
+ } else {
+ return 0;
+ }
+ *dest = arg;
+ return 1;
+}
+/* }}} */
+
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) {
convert_to_string(arg);
*dest = Z_STR_P(arg);
} else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
+ zend_object *zobj = Z_OBJ_P(arg);
+
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
zval obj;
- if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, IS_STRING) == SUCCESS) {
- zval_ptr_dtor(arg);
+ if (zobj->handlers->cast_object(zobj, &obj, IS_STRING) == SUCCESS) {
+ OBJ_RELEASE(zobj);
ZVAL_COPY_VALUE(arg, &obj);
*dest = Z_STR_P(arg);
return 1;
}
- } else if (Z_OBJ_HANDLER_P(arg, get)) {
- zval rv;
- zval *z = Z_OBJ_HANDLER_P(arg, get)(arg, &rv);
-
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zval_ptr_dtor(arg);
- if (Z_TYPE_P(z) == IS_STRING) {
- ZVAL_COPY_VALUE(arg, z);
- } else {
- ZVAL_STR(arg, zval_get_string_func(z));
- zval_ptr_dtor(z);
- }
- *dest = Z_STR_P(arg);
- return 1;
- }
- zval_ptr_dtor(z);
}
return 0;
} else {
@@ -594,7 +467,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest
}
/* }}} */
-static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity) /* {{{ */
+static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error) /* {{{ */
{
const char *spec_walk = *spec;
char c = *spec_walk++;
@@ -619,7 +492,6 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
switch (c) {
case 'l':
- case 'L':
{
zend_long *p = va_arg(*va, zend_long *);
zend_bool *is_null = NULL;
@@ -628,7 +500,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
is_null = va_arg(*va, zend_bool *);
}
- if (!zend_parse_arg_long(arg, p, is_null, check_null, c == 'L')) {
+ if (!zend_parse_arg_long(arg, p, is_null, check_null)) {
return "int";
}
}
@@ -809,23 +681,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
if (zend_fcall_info_init(arg, 0, fci, fcc, NULL, &is_callable_error) == SUCCESS) {
- if (is_callable_error) {
- *severity = E_DEPRECATED;
- zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
- efree(is_callable_error);
- *spec = spec_walk;
- return "";
- }
+ ZEND_ASSERT(!is_callable_error);
break;
+ }
+
+ if (is_callable_error) {
+ zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
+ efree(is_callable_error);
+ return "";
} else {
- if (is_callable_error) {
- *severity = E_ERROR;
- zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
- efree(is_callable_error);
- return "";
- } else {
- return "valid callback";
- }
+ return "valid callback";
}
}
@@ -837,9 +702,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
break;
- case 'Z':
- /* 'Z' iz not supported anymore and should be replaced with 'z' */
- ZEND_ASSERT(c != 'Z');
+ case 'Z': /* replace with 'z' */
+ case 'L': /* replace with 'l' */
+ ZEND_ASSERT(0 && "ZPP modifier no longer supported");
default:
return "unknown";
}
@@ -854,9 +719,8 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec
{
const char *expected_type = NULL;
char *error = NULL;
- int severity = 0;
- expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity);
+ expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error);
if (expected_type) {
if (EG(exception)) {
return FAILURE;
@@ -864,23 +728,18 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec
if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_bool throw_exception =
- ZEND_ARG_USES_STRICT_TYPES() || (flags & ZEND_PARSE_PARAMS_THROW);
if (error) {
- zend_internal_type_error(throw_exception, "%s%s%s() expects parameter %d %s",
+ zend_type_error("%s%s%s() expects parameter %d %s",
class_name, space, get_active_function_name(), arg_num, error);
efree(error);
} else {
- zend_internal_type_error(throw_exception,
- "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), arg_num, expected_type,
zend_zval_type_name(arg));
}
}
- if (severity != E_DEPRECATED) {
- return FAILURE;
- }
+ return FAILURE;
}
return SUCCESS;
@@ -982,8 +841,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (!(flags & ZEND_PARSE_PARAMS_QUIET)) {
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_bool throw_exception = ZEND_ARG_USES_STRICT_TYPES() || (flags & ZEND_PARSE_PARAMS_THROW);
- zend_internal_argument_count_error(throw_exception, "%s%s%s() expects %s %d parameter%s, %d given",
+ zend_argument_count_error("%s%s%s() expects %s %d parameter%s, %d given",
class_name,
class_name[0] ? "::" : "",
ZSTR_VAL(active_function->common.function_name),
@@ -1076,7 +934,7 @@ ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ..
{
va_list va;
int retval;
- int flags = ZEND_PARSE_PARAMS_THROW;
+ int flags = 0;
va_start(va, type_spec);
retval = zend_parse_va_args(num_args, type_spec, &va, flags);
@@ -1166,7 +1024,8 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this
* because it may call __set from the uninitialized object otherwise. */
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
{
- const zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj);
+ zend_object *zobj = Z_OBJ_P(obj);
+ zend_object_write_property_t write_property = zobj->handlers->write_property;
zend_class_entry *old_scope = EG(fake_scope);
zend_string *key;
zval *value;
@@ -1174,10 +1033,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
EG(fake_scope) = Z_OBJCE_P(obj);
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, value) {
if (key) {
- zval member;
-
- ZVAL_STR(&member, key);
- obj_ht->write_property(obj, &member, value, NULL);
+ write_property(zobj, key, value, NULL);
}
} ZEND_HASH_FOREACH_END();
EG(fake_scope) = old_scope;
@@ -1223,7 +1079,7 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
val = (zval*)((char*)class_type->default_properties_table + prop_info->offset - OBJ_PROP_TO_OFFSET(0));
}
if (Z_TYPE_P(val) == IS_CONSTANT_AST) {
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
zval tmp;
ZVAL_COPY(&tmp, val);
@@ -1300,7 +1156,7 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
(property_info->flags & ZEND_ACC_STATIC) == 0) {
zval *slot = OBJ_PROP(object, property_info->offset);
- if (UNEXPECTED(property_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) {
zval tmp;
ZVAL_COPY_VALUE(&tmp, prop);
@@ -1705,7 +1561,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value);
break;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
result = NULL;
}
@@ -1800,11 +1656,11 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len,
ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */
{
- zval z_key;
+ zend_string *str;
- ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value, NULL);
- zval_ptr_dtor(&z_key);
+ str = zend_string_init(key, key_len, 0);
+ Z_OBJ_HANDLER_P(arg, write_property)(Z_OBJ_P(arg), str, value, NULL);
+ zend_string_release_ex(str, 0);
return SUCCESS;
}
/* }}} */
@@ -2313,13 +2169,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
if (scope) {
- /* Look for ctor, dtor, clone
- * If it's an old-style constructor, store it only if we don't have
- * a constructor already.
- */
- if ((fname_len == class_name_len) && !ctor && !memcmp(ZSTR_VAL(lowercase_name), lc_class_name, class_name_len+1)) {
- ctor = reg_function;
- } else if (zend_string_equals_literal(lowercase_name, "serialize")) {
+ /* Look for ctor, dtor, clone */
+ if (zend_string_equals_literal(lowercase_name, "serialize")) {
serialize_func = reg_function;
} else if (zend_string_equals_literal(lowercase_name, "unserialize")) {
unserialize_func = reg_function;
@@ -2401,26 +2252,22 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name));
}
- ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (dtor) {
dtor->common.fn_flags |= ZEND_ACC_DTOR;
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Destructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name));
}
- dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (clone) {
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "%s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name));
}
- clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__call) {
if (__call->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__call->common.function_name));
}
- __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__callstatic) {
if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) {
@@ -2432,31 +2279,26 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (__tostring->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__tostring->common.function_name));
}
- __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__get) {
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__get->common.function_name));
}
- __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__set) {
if (__set->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__set->common.function_name));
}
- __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__unset) {
if (__unset->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__unset->common.function_name));
}
- __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__isset) {
if (__isset->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__isset->common.function_name));
}
- __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__debugInfo) {
if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) {
@@ -2976,11 +2818,8 @@ static int zend_is_callable_check_class(zend_string *name, zend_class_entry *sco
ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) {
if (fcc->function_handler &&
- ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
- fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
- fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
- if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
- fcc->function_handler->common.function_name) {
+ (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
+ if (fcc->function_handler->common.function_name) {
zend_string_release_ex(fcc->function_handler->common.function_name, 0);
}
zend_free_trampoline(fcc->function_handler);
@@ -3138,8 +2977,7 @@ get_function_via_handler:
(!fcc->function_handler->common.scope ||
!instanceof_function(ce_org, fcc->function_handler->common.scope))) {
if (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
- if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
- fcc->function_handler->common.function_name) {
+ if (fcc->function_handler->common.function_name) {
zend_string_release_ex(fcc->function_handler->common.function_name, 0);
}
zend_free_trampoline(fcc->function_handler);
@@ -3178,30 +3016,9 @@ get_function_via_handler:
zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
}
} else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
- int severity;
- char *verb;
- if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_DEPRECATED;
- verb = "should not";
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- severity = E_ERROR;
- verb = "cannot";
- }
- if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
- retval = 0;
- }
+ retval = 0;
if (error) {
- zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- if (severity != E_DEPRECATED) {
- retval = 0;
- }
- } else if (retval) {
- if (severity == E_ERROR) {
- zend_throw_error(NULL, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- } else {
- zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- }
+ zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
}
}
if (retval
@@ -3292,16 +3109,18 @@ try_again:
zend_class_entry *calling_scope;
zend_function *fptr;
zend_object *object;
- if (Z_OBJ_HANDLER_P(callable, get_closure)
- && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &calling_scope, &fptr, &object) == SUCCESS) {
- zend_class_entry *ce = Z_OBJCE_P(callable);
+ zend_object *zobj = Z_OBJ_P(callable);
+
+ if (zobj->handlers->get_closure
+ && zobj->handlers->get_closure(zobj, &calling_scope, &fptr, &object, 1) == SUCCESS) {
+ zend_class_entry *ce = zobj->ce;
zend_string *callable_name = zend_string_alloc(
ZSTR_LEN(ce->name) + sizeof("::__invoke") - 1, 0);
memcpy(ZSTR_VAL(callable_name), ZSTR_VAL(ce->name), ZSTR_LEN(ce->name));
memcpy(ZSTR_VAL(callable_name) + ZSTR_LEN(ce->name), "::__invoke", sizeof("::__invoke"));
return callable_name;
}
- return zval_get_string(callable);
+ return zval_get_string_func(callable);
}
case IS_REFERENCE:
callable = Z_REFVAL_P(callable);
@@ -3418,17 +3237,12 @@ check_func:
}
return 0;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(callable, get_closure)) {
- if (Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
- fcc->called_scope = fcc->calling_scope;
- if (fcc == &fcc_local) {
- zend_release_fcall_info_cache(fcc);
- }
- return 1;
- } else {
- /* Discard exceptions thrown from Z_OBJ_HANDLER_P(callable, get_closure) */
- zend_clear_exception();
+ if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object, 1) == SUCCESS) {
+ fcc->called_scope = fcc->calling_scope;
+ if (fcc == &fcc_local) {
+ zend_release_fcall_info_cache(fcc);
}
+ return 1;
}
if (error) *error = estrdup("no array or string given");
return 0;
@@ -3461,7 +3275,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam
{
zend_fcall_info_cache fcc;
- if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) {
+ if (zend_is_callable_ex(callable, NULL, 0, callable_name, &fcc, NULL)) {
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_ptr_dtor_str(callable);
array_init(callable);
@@ -3912,7 +3726,7 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */
{
- return zend_declare_typed_property(ce, name, property, access_type, doc_comment, 0);
+ return zend_declare_typed_property(ce, name, property, access_type, doc_comment, ZEND_TYPE_ENCODE_NONE());
}
/* }}} */
@@ -4090,13 +3904,11 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char
ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zend_string *name, zval *value) /* {{{ */
{
- zval property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STR(&property, name);
- Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL);
+ Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), name, value, NULL);
EG(fake_scope) = old_scope;
}
@@ -4104,14 +3916,14 @@ ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zen
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zval *value) /* {{{ */
{
- zval property;
+ zend_string *property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STRINGL(&property, name, name_length);
- Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL);
- zval_ptr_dtor(&property);
+ property = zend_string_init(name, name_length, 0);
+ Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), property, value, NULL);
+ zend_string_release_ex(property, 0);
EG(fake_scope) = old_scope;
}
@@ -4128,14 +3940,14 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length) /* {{{ */
{
- zval property;
+ zend_string *property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STRINGL(&property, name, name_length);
- Z_OBJ_HT_P(object)->unset_property(object, &property, 0);
- zval_ptr_dtor(&property);
+ property = zend_string_init(name, name_length, 0);
+ Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), property, 0);
+ zend_string_release_ex(property, 0);
EG(fake_scope) = old_scope;
}
@@ -4213,7 +4025,7 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string
ZEND_ASSERT(!Z_ISREF_P(value));
Z_TRY_ADDREF_P(value);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZVAL_COPY_VALUE(&tmp, value);
if (!zend_verify_property_type(prop_info, &tmp, /* strict */ 0)) {
Z_TRY_DELREF_P(value);
@@ -4294,13 +4106,12 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zval *object, zend_string *name, zend_bool silent, zval *rv) /* {{{ */
{
- zval property, *value;
+ zval *value;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STR(&property, name);
- value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, NULL, rv);
+ value = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), name, silent?BP_VAR_IS:BP_VAR_R, NULL, rv);
EG(fake_scope) = old_scope;
return value;
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 2a3b582902..acc6bb9cf3 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -27,6 +27,7 @@
#include "zend_operators.h"
#include "zend_variables.h"
#include "zend_execute.h"
+#include "zend_type_info.h"
BEGIN_EXTERN_C()
@@ -98,11 +99,11 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_ARG_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 0},
#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, pass_by_ref, 0},
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_ARRAY, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_CALLABLE, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 0 },
+#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(IS_ARRAY, allow_null), pass_by_ref, 0 },
+#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(IS_CALLABLE, allow_null), pass_by_ref, 0 },
+#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(type_hint, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 1 },
-#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 1 },
+#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(type_hint, allow_null), pass_by_ref, 1 },
#define ZEND_ARG_VARIADIC_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 1 },
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
@@ -114,7 +115,7 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
static const zend_internal_arg_info name[] = { \
- { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE(type, allow_null), return_reference, 0 },
+ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CODE(type, allow_null), return_reference, 0 },
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(name, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, 0, -1, type, allow_null)
@@ -249,16 +250,16 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array);
#define zend_parse_parameters_none() \
(EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : (zend_wrong_parameters_none_error(), FAILURE))
#define zend_parse_parameters_none_throw() \
- (EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : (zend_wrong_parameters_none_exception(), FAILURE))
+ zend_parse_parameters_none()
/* Parameter parsing API -- andrei */
+#define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */
#define ZEND_PARSE_PARAMS_QUIET (1<<1)
-#define ZEND_PARSE_PARAMS_THROW (1<<2)
ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...);
ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...);
ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ...);
-ZEND_API char *zend_zval_type_name(const zval *arg);
+ZEND_API const char *zend_zval_type_name(const zval *arg);
ZEND_API zend_string *zend_zval_get_type(const zval *arg);
ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...);
@@ -298,11 +299,8 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void);
#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
-#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
#define IS_CALLABLE_CHECK_SILENT (1<<3)
-#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
-
ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc);
ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *object);
ZEND_API zend_string *zend_get_callable_name(zval *callable);
@@ -360,7 +358,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool silent);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent);
-ZEND_API char *zend_get_type_by_const(int type);
+ZEND_API const char *zend_get_type_by_const(int type);
#define ZEND_THIS (&EX(This))
@@ -477,7 +475,6 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
* fci->param_count = 0;
* fci->params = NULL;
* The callable_name argument may be NULL.
- * Set check_flags to IS_CALLABLE_STRICT for every new usage!
*/
ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error);
@@ -542,7 +539,7 @@ static zend_always_inline int zend_forbid_dynamic_call(const char *func_name)
ZEND_ASSERT(ex != NULL && ex->func != NULL);
if (ZEND_CALL_INFO(ex) & ZEND_CALL_DYNAMIC) {
- zend_error(E_WARNING, "Cannot call %s dynamically", func_name);
+ zend_throw_error(NULL, "Cannot call %s dynamically", func_name);
return FAILURE;
}
@@ -636,26 +633,26 @@ END_EXTERN_C()
#define RETVAL_FALSE ZVAL_FALSE(return_value)
#define RETVAL_TRUE ZVAL_TRUE(return_value)
-#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
-#define RETURN_NULL() { RETVAL_NULL(); return;}
-#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
-#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
-#define RETURN_STR(s) { RETVAL_STR(s); return; }
-#define RETURN_INTERNED_STR(s) { RETVAL_INTERNED_STR(s); return; }
-#define RETURN_NEW_STR(s) { RETVAL_NEW_STR(s); return; }
-#define RETURN_STR_COPY(s) { RETVAL_STR_COPY(s); return; }
-#define RETURN_STRING(s) { RETVAL_STRING(s); return; }
-#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; }
-#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
-#define RETURN_RES(r) { RETVAL_RES(r); return; }
-#define RETURN_ARR(r) { RETVAL_ARR(r); return; }
-#define RETURN_EMPTY_ARRAY() { RETVAL_EMPTY_ARRAY(); return; }
-#define RETURN_OBJ(r) { RETVAL_OBJ(r); return; }
-#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
-#define RETURN_FALSE { RETVAL_FALSE; return; }
-#define RETURN_TRUE { RETVAL_TRUE; return; }
-
-#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))
+#define RETURN_BOOL(b) do { RETVAL_BOOL(b); return; } while (0)
+#define RETURN_NULL() do { RETVAL_NULL(); return;} while (0)
+#define RETURN_LONG(l) do { RETVAL_LONG(l); return; } while (0)
+#define RETURN_DOUBLE(d) do { RETVAL_DOUBLE(d); return; } while (0)
+#define RETURN_STR(s) do { RETVAL_STR(s); return; } while (0)
+#define RETURN_INTERNED_STR(s) do { RETVAL_INTERNED_STR(s); return; } while (0)
+#define RETURN_NEW_STR(s) do { RETVAL_NEW_STR(s); return; } while (0)
+#define RETURN_STR_COPY(s) do { RETVAL_STR_COPY(s); return; } while (0)
+#define RETURN_STRING(s) do { RETVAL_STRING(s); return; } while (0)
+#define RETURN_STRINGL(s, l) do { RETVAL_STRINGL(s, l); return; } while (0)
+#define RETURN_EMPTY_STRING() do { RETVAL_EMPTY_STRING(); return; } while (0)
+#define RETURN_RES(r) do { RETVAL_RES(r); return; } while (0)
+#define RETURN_ARR(r) do { RETVAL_ARR(r); return; } while (0)
+#define RETURN_EMPTY_ARRAY() do { RETVAL_EMPTY_ARRAY(); return; } while (0)
+#define RETURN_OBJ(r) do { RETVAL_OBJ(r); return; } while (0)
+#define RETURN_ZVAL(zv, copy, dtor) do { RETVAL_ZVAL(zv, copy, dtor); return; } while (0)
+#define RETURN_FALSE do { RETVAL_FALSE; return; } while (0)
+#define RETURN_TRUE do { RETVAL_TRUE; return; } while (0)
+
+#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL)))
#define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL)
/* For compatibility */
@@ -1107,7 +1104,8 @@ static zend_always_inline zval *zend_try_array_init(zval *zv)
_(Z_EXPECTED_RESOURCE, "resource") \
_(Z_EXPECTED_PATH, "a valid path") \
_(Z_EXPECTED_OBJECT, "object") \
- _(Z_EXPECTED_DOUBLE, "float")
+ _(Z_EXPECTED_DOUBLE, "float") \
+ _(Z_EXPECTED_NUMBER, "int or float") \
#define Z_EXPECTED_TYPE_ENUM(id, str) id,
#define Z_EXPECTED_TYPE_STR(id, str) str,
@@ -1118,16 +1116,10 @@ typedef enum _zend_expected_type {
} zend_expected_type;
ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void);
-ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(void);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_num_args, int max_num_args);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception(int min_num_args, int max_num_args);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, zend_expected_type expected_type, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int num, zend_expected_type expected_type, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg);
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error);
#define ZPP_ERROR_OK 0
#define ZPP_ERROR_FAILURE 1
@@ -1161,11 +1153,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
(UNEXPECTED(_num_args > _max_num_args) && \
EXPECTED(_max_num_args >= 0))) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameters_count_exception(_min_num_args, _max_num_args); \
- } else { \
- zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \
- } \
+ zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \
} \
_error_code = ZPP_ERROR_FAILURE; \
break; \
@@ -1187,23 +1175,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
if (UNEXPECTED(_error_code != ZPP_ERROR_OK)) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
if (_error_code == ZPP_ERROR_WRONG_CALLBACK) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_callback_exception(_i, _error); \
- } else { \
- zend_wrong_callback_error(_i, _error); \
- } \
+ zend_wrong_callback_error(_i, _error); \
} else if (_error_code == ZPP_ERROR_WRONG_CLASS) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameter_class_exception(_i, _error, _arg); \
- } else { \
- zend_wrong_parameter_class_error(_i, _error, _arg); \
- } \
+ zend_wrong_parameter_class_error(_i, _error, _arg); \
} else if (_error_code == ZPP_ERROR_WRONG_ARG) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameter_type_exception(_i, _expected_type, _arg); \
- } else { \
- zend_wrong_parameter_type_error(_i, _expected_type, _arg); \
- } \
+ zend_wrong_parameter_type_error(_i, _expected_type, _arg); \
} \
} \
failure; \
@@ -1316,14 +1292,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
if (!_error) { \
_expected_type = Z_EXPECTED_FUNC; \
_error_code = ZPP_ERROR_WRONG_ARG; \
- break; \
} else { \
_error_code = ZPP_ERROR_WRONG_CALLBACK; \
- break; \
} \
- } else if (UNEXPECTED(_error != NULL)) { \
- zend_wrong_callback_deprecated(_i, _error); \
- }
+ break; \
+ } \
#define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) \
Z_PARAM_FUNC_EX2(dest_fci, dest_fcc, check_null, separate, separate)
@@ -1364,7 +1337,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
/* old "l" */
#define Z_PARAM_LONG_EX2(dest, is_null, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 0))) { \
+ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null))) { \
_expected_type = Z_EXPECTED_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@@ -1376,20 +1349,21 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_LONG(dest) \
Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
-/* old "L" */
-#define Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, deref, separate) \
- Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 1))) { \
- _expected_type = Z_EXPECTED_LONG; \
- _error_code = ZPP_ERROR_WRONG_ARG; \
- break; \
- }
-#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) \
- Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, separate, separate)
+/* no old equivalent */
+#define Z_PARAM_NUMBER_EX(dest, check_null) \
+ Z_PARAM_PROLOGUE(0, 0); \
+ if (UNEXPECTED(!zend_parse_arg_number(_arg, &dest, check_null))) { \
+ _expected_type = Z_EXPECTED_NUMBER; \
+ _error_code = ZPP_ERROR_WRONG_ARG; \
+ break; \
+ }
+
+#define Z_PARAM_NUMBER_OR_NULL(dest) \
+ Z_PARAM_NUMBER_EX(dest, 1)
-#define Z_PARAM_STRICT_LONG(dest) \
- Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
+#define Z_PARAM_NUMBER(dest) \
+ Z_PARAM_NUMBER_EX(dest, 0)
/* old "o" */
#define Z_PARAM_OBJECT_EX2(dest, check_null, deref, separate) \
@@ -1513,14 +1487,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_ZVAL(dest) \
Z_PARAM_ZVAL_EX(dest, 0, 0)
-/* old "z" (with dereference) */
-#define Z_PARAM_ZVAL_DEREF_EX(dest, check_null, separate) \
- Z_PARAM_PROLOGUE(1, separate); \
- zend_parse_arg_zval_deref(_arg, &dest, check_null);
-
-#define Z_PARAM_ZVAL_DEREF(dest) \
- Z_PARAM_ZVAL_DEREF_EX(dest, 0, 0)
-
/* old "+" and "*" */
#define Z_PARAM_VARIADIC_EX(spec, dest, dest_num, post_varargs) do { \
int _num_varargs = _num_args - _i - (post_varargs); \
@@ -1547,12 +1513,11 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest);
+ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest);
static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null)
{
@@ -1572,7 +1537,7 @@ static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, ze
return 1;
}
-static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null, int cap)
+static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null)
{
if (check_null) {
*is_null = 0;
@@ -1582,8 +1547,6 @@ static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, ze
} else if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*is_null = 1;
*dest = 0;
- } else if (cap) {
- return zend_parse_arg_long_cap_slow(arg, dest);
} else {
return zend_parse_arg_long_slow(arg, dest);
}
@@ -1606,6 +1569,18 @@ static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zen
return 1;
}
+static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int check_null)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_LONG || Z_TYPE_P(arg) == IS_DOUBLE)) {
+ *dest = arg;
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return zend_parse_arg_number_slow(arg, dest);
+ }
+ return 1;
+}
+
static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, int check_null)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
@@ -1679,15 +1654,16 @@ static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **des
if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
*dest = Z_ARRVAL_P(arg);
} else if (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
+ zend_object *zobj = Z_OBJ_P(arg);
if (separate
- && Z_OBJ_P(arg)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(arg)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(arg)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(arg)->properties);
+ && zobj->properties
+ && UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(zobj->properties);
}
- Z_OBJ_P(arg)->properties = zend_array_dup(Z_OBJ_P(arg)->properties);
+ zobj->properties = zend_array_dup(zobj->properties);
}
- *dest = Z_OBJ_HT_P(arg)->get_properties(arg);
+ *dest = zobj->handlers->get_properties(zobj);
} else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index abbb3f952b..660e6d5b6f 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -411,9 +411,9 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
switch (Z_TYPE_P(offset)) {
case IS_UNDEF:
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
- zend_error(E_WARNING,
+ zend_throw_error(NULL,
"Cannot add element to the array as the next element is already occupied");
- zval_ptr_dtor_nogc(expr);
+ return FAILURE;
}
break;
case IS_STRING:
@@ -440,7 +440,7 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
zend_hash_index_update(Z_ARRVAL_P(result), Z_RES_HANDLE_P(offset), expr);
break;
default:
- zend_throw_error(NULL, "Illegal offset type");
+ zend_type_error("Illegal offset type");
return FAILURE;
}
return SUCCESS;
@@ -458,8 +458,9 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) {
return FAILURE;
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), val)) {
- zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
- break;
+ zend_throw_error(NULL,
+ "Cannot add element to the array as the next element is already occupied");
+ return FAILURE;
}
Z_TRY_ADDREF_P(val);
}
@@ -910,8 +911,9 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn) {
* 160 left &
* 170 non-associative == != === !==
* 180 non-associative < <= > >= <=>
+ * 185 left .
* 190 left << >>
- * 200 left + - .
+ * 200 left + -
* 210 left * / %
* 220 right !
* 230 non-associative instanceof
@@ -1738,8 +1740,7 @@ simple_list:
case ZEND_MOD: BINARY_OP(" % ", 210, 210, 211);
case ZEND_SL: BINARY_OP(" << ", 190, 190, 191);
case ZEND_SR: BINARY_OP(" >> ", 190, 190, 191);
- case ZEND_PARENTHESIZED_CONCAT: /* fallthrough */
- case ZEND_CONCAT: BINARY_OP(" . ", 200, 200, 201);
+ case ZEND_CONCAT: BINARY_OP(" . ", 185, 185, 186);
case ZEND_BW_OR: BINARY_OP(" | ", 140, 140, 141);
case ZEND_BW_AND: BINARY_OP(" & ", 160, 160, 161);
case ZEND_BW_XOR: BINARY_OP(" ^ ", 150, 150, 151);
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index d3bf032c10..f16bf1540f 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -37,7 +37,6 @@ static ZEND_FUNCTION(strcmp);
static ZEND_FUNCTION(strncmp);
static ZEND_FUNCTION(strcasecmp);
static ZEND_FUNCTION(strncasecmp);
-static ZEND_FUNCTION(each);
static ZEND_FUNCTION(error_reporting);
static ZEND_FUNCTION(define);
static ZEND_FUNCTION(defined);
@@ -68,7 +67,6 @@ static ZEND_FUNCTION(get_declared_traits);
static ZEND_FUNCTION(get_declared_interfaces);
static ZEND_FUNCTION(get_defined_functions);
static ZEND_FUNCTION(get_defined_vars);
-static ZEND_FUNCTION(create_function);
static ZEND_FUNCTION(get_resource_type);
static ZEND_FUNCTION(get_resources);
static ZEND_FUNCTION(get_loaded_extensions);
@@ -87,219 +85,69 @@ static ZEND_FUNCTION(gc_enable);
static ZEND_FUNCTION(gc_disable);
static ZEND_FUNCTION(gc_status);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_zend__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1)
- ZEND_ARG_INFO(0, arg_num)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strcmp, 0, 0, 2)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_each, 0, 0, 1)
- ZEND_ARG_INFO(1, arr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0)
- ZEND_ARG_INFO(0, new_error_level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_define, 0, 0, 2)
- ZEND_ARG_INFO(0, constant_name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, case_insensitive)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_defined, 0, 0, 1)
- ZEND_ARG_INFO(0, constant_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_subclass_of, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, allow_string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_object_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_mangled_object_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_methods, 0, 0, 1)
- ZEND_ARG_INFO(0, class)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_method_exists, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_property_exists, 0, 0, 2)
- ZEND_ARG_INFO(0, object_or_class)
- ZEND_ARG_INFO(0, property_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, classname)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trait_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, traitname)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_function_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_alias, 0, 0, 2)
- ZEND_ARG_INFO(0, user_class_name)
- ZEND_ARG_INFO(0, alias_name)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trigger_error, 0, 0, 1)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, error_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, error_handler)
- ZEND_ARG_INFO(0, error_types)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, exception_handler)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 0)
- ZEND_ARG_INFO(0, exclude_disabled)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resource_type, 0, 0, 1)
- ZEND_ARG_INFO(0, res)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resources, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_loaded_extensions, 0, 0, 0)
- ZEND_ARG_INFO(0, zend_extensions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_constants, 0, 0, 0)
- ZEND_ARG_INFO(0, categorize)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_backtrace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_print_backtrace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_extension_loaded, 0, 0, 1)
- ZEND_ARG_INFO(0, extension_name)
-ZEND_END_ARG_INFO()
+#include "zend_builtin_functions_arginfo.h"
/* }}} */
static const zend_function_entry builtin_functions[] = { /* {{{ */
- ZEND_FE(zend_version, arginfo_zend__void)
- ZEND_FE(func_num_args, arginfo_zend__void)
+ ZEND_FE(zend_version, arginfo_zend_version)
+ ZEND_FE(func_num_args, arginfo_func_num_args)
ZEND_FE(func_get_arg, arginfo_func_get_arg)
- ZEND_FE(func_get_args, arginfo_zend__void)
+ ZEND_FE(func_get_args, arginfo_func_get_args)
ZEND_FE(strlen, arginfo_strlen)
ZEND_FE(strcmp, arginfo_strcmp)
ZEND_FE(strncmp, arginfo_strncmp)
ZEND_FE(strcasecmp, arginfo_strcmp)
ZEND_FE(strncasecmp, arginfo_strncmp)
- ZEND_FE(each, arginfo_each)
ZEND_FE(error_reporting, arginfo_error_reporting)
ZEND_FE(define, arginfo_define)
ZEND_FE(defined, arginfo_defined)
ZEND_FE(get_class, arginfo_get_class)
- ZEND_FE(get_called_class, arginfo_zend__void)
- ZEND_FE(get_parent_class, arginfo_get_class)
+ ZEND_FE(get_called_class, arginfo_get_called_class)
+ ZEND_FE(get_parent_class, arginfo_get_parent_class)
ZEND_FE(method_exists, arginfo_method_exists)
ZEND_FE(property_exists, arginfo_property_exists)
ZEND_FE(class_exists, arginfo_class_exists)
- ZEND_FE(interface_exists, arginfo_class_exists)
+ ZEND_FE(interface_exists, arginfo_interface_exists)
ZEND_FE(trait_exists, arginfo_trait_exists)
ZEND_FE(function_exists, arginfo_function_exists)
ZEND_FE(class_alias, arginfo_class_alias)
- ZEND_FE(get_included_files, arginfo_zend__void)
- ZEND_FALIAS(get_required_files, get_included_files, arginfo_zend__void)
+ ZEND_FE(get_included_files, arginfo_get_included_files)
+ ZEND_FALIAS(get_required_files, get_included_files, arginfo_get_required_files)
ZEND_FE(is_subclass_of, arginfo_is_subclass_of)
- ZEND_FE(is_a, arginfo_is_subclass_of)
+ ZEND_FE(is_a, arginfo_is_a)
ZEND_FE(get_class_vars, arginfo_get_class_vars)
ZEND_FE(get_object_vars, arginfo_get_object_vars)
ZEND_FE(get_mangled_object_vars, arginfo_get_mangled_object_vars)
ZEND_FE(get_class_methods, arginfo_get_class_methods)
ZEND_FE(trigger_error, arginfo_trigger_error)
- ZEND_FALIAS(user_error, trigger_error, arginfo_trigger_error)
+ ZEND_FALIAS(user_error, trigger_error, arginfo_user_error)
ZEND_FE(set_error_handler, arginfo_set_error_handler)
- ZEND_FE(restore_error_handler, arginfo_zend__void)
+ ZEND_FE(restore_error_handler, arginfo_restore_error_handler)
ZEND_FE(set_exception_handler, arginfo_set_exception_handler)
- ZEND_FE(restore_exception_handler, arginfo_zend__void)
- ZEND_FE(get_declared_classes, arginfo_zend__void)
- ZEND_FE(get_declared_traits, arginfo_zend__void)
- ZEND_FE(get_declared_interfaces, arginfo_zend__void)
+ ZEND_FE(restore_exception_handler, arginfo_restore_exception_handler)
+ ZEND_FE(get_declared_classes, arginfo_get_declared_classes)
+ ZEND_FE(get_declared_traits, arginfo_get_declared_traits)
+ ZEND_FE(get_declared_interfaces, arginfo_get_declared_interfaces)
ZEND_FE(get_defined_functions, arginfo_get_defined_functions)
- ZEND_FE(get_defined_vars, arginfo_zend__void)
- ZEND_DEP_FE(create_function, arginfo_create_function)
+ ZEND_FE(get_defined_vars, arginfo_get_defined_vars)
ZEND_FE(get_resource_type, arginfo_get_resource_type)
ZEND_FE(get_resources, arginfo_get_resources)
ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions)
ZEND_FE(extension_loaded, arginfo_extension_loaded)
- ZEND_FE(get_extension_funcs, arginfo_extension_loaded)
+ ZEND_FE(get_extension_funcs, arginfo_get_extension_funcs)
ZEND_FE(get_defined_constants, arginfo_get_defined_constants)
ZEND_FE(debug_backtrace, arginfo_debug_backtrace)
ZEND_FE(debug_print_backtrace, arginfo_debug_print_backtrace)
#if ZEND_DEBUG && defined(ZTS)
- ZEND_FE(zend_thread_id, NULL)
+ ZEND_FE(zend_thread_id, arginfo_zend_thread_id)
#endif
- ZEND_FE(gc_mem_caches, arginfo_zend__void)
- ZEND_FE(gc_collect_cycles, arginfo_zend__void)
- ZEND_FE(gc_enabled, arginfo_zend__void)
- ZEND_FE(gc_enable, arginfo_zend__void)
- ZEND_FE(gc_disable, arginfo_zend__void)
- ZEND_FE(gc_status, arginfo_zend__void)
+ ZEND_FE(gc_mem_caches, arginfo_gc_mem_caches)
+ ZEND_FE(gc_collect_cycles, arginfo_gc_collect_cycles)
+ ZEND_FE(gc_enabled, arginfo_gc_enabled)
+ ZEND_FE(gc_enable, arginfo_gc_enable)
+ ZEND_FE(gc_disable, arginfo_gc_disable)
+ ZEND_FE(gc_status, arginfo_gc_status)
ZEND_FE_END
};
/* }}} */
@@ -668,66 +516,6 @@ ZEND_FUNCTION(strncasecmp)
}
/* }}} */
-/* {{{ proto mixed each(array &arr)
- Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */
-ZEND_FUNCTION(each)
-{
- zval *array, *entry, tmp;
- zend_ulong num_key;
- HashTable *target_hash;
- zend_string *key;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) {
- return;
- }
-
- if (!EG(each_deprecation_thrown)) {
- zend_error(E_DEPRECATED, "The each() function is deprecated. This message will be suppressed on further calls");
- EG(each_deprecation_thrown) = 1;
- }
-
- target_hash = HASH_OF(array);
- if (!target_hash) {
- zend_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- while (1) {
- entry = zend_hash_get_current_data(target_hash);
- if (!entry) {
- RETURN_FALSE;
- } else if (Z_TYPE_P(entry) == IS_INDIRECT) {
- entry = Z_INDIRECT_P(entry);
- if (Z_TYPE_P(entry) == IS_UNDEF) {
- zend_hash_move_forward(target_hash);
- continue;
- }
- }
- break;
- }
- array_init_size(return_value, 4);
- zend_hash_real_init_mixed(Z_ARRVAL_P(return_value));
-
- /* add value elements */
- ZVAL_DEREF(entry);
- if (Z_REFCOUNTED_P(entry)) {
- GC_ADDREF_EX(Z_COUNTED_P(entry), 2);
- }
- zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry);
- zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry);
-
- /* add the key elements */
- if (zend_hash_get_current_key(target_hash, &key, &num_key) == HASH_KEY_IS_STRING) {
- ZVAL_STR_COPY(&tmp, key);
- Z_TRY_ADDREF(tmp);
- } else {
- ZVAL_LONG(&tmp, num_key);
- }
- zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
- zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_KEY), &tmp);
- zend_hash_move_forward(target_hash);
-}
-/* }}} */
-
/* {{{ proto int error_reporting([int new_error_level])
Return the current error_reporting level, and if an argument was passed - change to the new level */
ZEND_FUNCTION(error_reporting)
@@ -851,7 +639,6 @@ ZEND_FUNCTION(define)
zend_string *name;
zval *val, val_free;
zend_bool non_cs = 0;
- int case_sensitive = CONST_CS;
zend_constant c;
ZEND_PARSE_PARAMETERS_START(2, 3)
@@ -861,18 +648,19 @@ ZEND_FUNCTION(define)
Z_PARAM_BOOL(non_cs)
ZEND_PARSE_PARAMETERS_END();
- if (non_cs) {
- case_sensitive = 0;
- }
-
if (zend_memnstr(ZSTR_VAL(name), "::", sizeof("::") - 1, ZSTR_VAL(name) + ZSTR_LEN(name))) {
zend_error(E_WARNING, "Class constants cannot be defined or redefined");
RETURN_FALSE;
}
+ if (non_cs) {
+ zend_error(E_WARNING,
+ "define(): Declaration of case-insensitive constants is no longer supported");
+ RETURN_FALSE;
+ }
+
ZVAL_UNDEF(&val_free);
-repeat:
switch (Z_TYPE_P(val)) {
case IS_LONG:
case IS_DOUBLE:
@@ -893,17 +681,10 @@ repeat:
}
break;
case IS_OBJECT:
- if (Z_TYPE(val_free) == IS_UNDEF) {
- if (Z_OBJ_HT_P(val)->get) {
- zval rv;
- val = Z_OBJ_HT_P(val)->get(val, &rv);
- ZVAL_COPY_VALUE(&val_free, val);
- goto repeat;
- } else if (Z_OBJ_HT_P(val)->cast_object) {
- if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING) == SUCCESS) {
- val = &val_free;
- break;
- }
+ if (Z_OBJ_HT_P(val)->cast_object) {
+ if (Z_OBJ_HT_P(val)->cast_object(Z_OBJ_P(val), &val_free, IS_STRING) == SUCCESS) {
+ val = &val_free;
+ break;
}
}
/* no break */
@@ -917,13 +698,8 @@ repeat:
zval_ptr_dtor(&val_free);
register_constant:
- if (non_cs) {
- zend_error(E_DEPRECATED,
- "define(): Declaration of case-insensitive constants is deprecated");
- }
-
/* non persistent */
- ZEND_CONSTANT_SET_FLAGS(&c, case_sensitive, PHP_USER_CONSTANT);
+ ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, PHP_USER_CONSTANT);
c.name = zend_string_copy(name);
if (zend_register_constant(&c) == SUCCESS) {
RETURN_TRUE;
@@ -944,7 +720,7 @@ ZEND_FUNCTION(defined)
Z_PARAM_STR(name)
ZEND_PARSE_PARAMETERS_END();
- if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT | ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) {
+ if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -959,7 +735,7 @@ ZEND_FUNCTION(get_class)
zval *obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &obj) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (!obj) {
@@ -1192,13 +968,12 @@ ZEND_FUNCTION(get_object_vars)
Z_PARAM_OBJECT(obj)
ZEND_PARSE_PARAMETERS_END();
- properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ zobj = Z_OBJ_P(obj);
+ properties = zobj->handlers->get_properties(zobj);
if (properties == NULL) {
- RETURN_FALSE;
+ RETURN_EMPTY_ARRAY();
}
- zobj = Z_OBJ_P(obj);
-
if (!zobj->ce->default_properties_count && properties == zobj->properties && !GC_IS_RECURSIVE(properties)) {
/* fast copy */
if (EXPECTED(zobj->handlers == &std_object_handlers)) {
@@ -1260,7 +1035,7 @@ ZEND_FUNCTION(get_mangled_object_vars)
Z_PARAM_OBJECT(obj)
ZEND_PARSE_PARAMETERS_END();
- properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
if (!properties) {
ZVAL_EMPTY_ARRAY(return_value);
return;
@@ -1408,7 +1183,6 @@ ZEND_FUNCTION(property_exists)
zend_string *property;
zend_class_entry *ce;
zend_property_info *property_info;
- zval property_z;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &object, &property) == FAILURE) {
return;
@@ -1437,10 +1211,8 @@ ZEND_FUNCTION(property_exists)
RETURN_TRUE;
}
- ZVAL_STR(&property_z, property);
-
if (Z_TYPE_P(object) == IS_OBJECT &&
- Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, NULL)) {
+ Z_OBJ_HANDLER_P(object, has_property)(Z_OBJ_P(object), property, 2, NULL)) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -1593,7 +1365,7 @@ ZEND_FUNCTION(get_included_files)
}
/* }}} */
-/* {{{ proto void trigger_error(string message [, int error_type])
+/* {{{ proto bool trigger_error(string message [, int error_type])
Generates a user-level error/warning/notice message */
ZEND_FUNCTION(trigger_error)
{
@@ -1862,78 +1634,6 @@ ZEND_FUNCTION(get_defined_vars)
}
/* }}} */
-#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
-/* {{{ proto string create_function(string args, string code)
- Creates an anonymous function, and returns its name (funny, eh?) */
-ZEND_FUNCTION(create_function)
-{
- zend_string *function_name;
- char *eval_code, *function_args, *function_code;
- size_t eval_code_length, function_args_len, function_code_len;
- int retval;
- char *eval_name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
- return;
- }
-
- eval_code = (char *) emalloc(sizeof("function " LAMBDA_TEMP_FUNCNAME)
- +function_args_len
- +2 /* for the args parentheses */
- +2 /* for the curly braces */
- +function_code_len);
-
- eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME "(") - 1;
- memcpy(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(", eval_code_length);
-
- memcpy(eval_code + eval_code_length, function_args, function_args_len);
- eval_code_length += function_args_len;
-
- eval_code[eval_code_length++] = ')';
- eval_code[eval_code_length++] = '{';
-
- memcpy(eval_code + eval_code_length, function_code, function_code_len);
- eval_code_length += function_code_len;
-
- eval_code[eval_code_length++] = '}';
- eval_code[eval_code_length] = '\0';
-
- eval_name = zend_make_compiled_string_description("runtime-created function");
- retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name);
- efree(eval_code);
- efree(eval_name);
-
- if (retval==SUCCESS) {
- zend_op_array *func;
- HashTable *static_variables;
-
- func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- if (!func) {
- zend_error_noreturn(E_CORE_ERROR, "Unexpected inconsistency in create_function()");
- RETURN_FALSE;
- }
- if (func->refcount) {
- (*func->refcount)++;
- }
- static_variables = func->static_variables;
- func->static_variables = NULL;
- zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- func->static_variables = static_variables;
-
- function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
- ZSTR_VAL(function_name)[0] = '\0';
-
- do {
- ZSTR_LEN(function_name) = snprintf(ZSTR_VAL(function_name) + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
- } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
- RETURN_NEW_STR(function_name);
- } else {
- zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
#if ZEND_DEBUG && defined(ZTS)
ZEND_FUNCTION(zend_thread_id)
{
diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php
new file mode 100644
index 0000000000..c3052db108
--- /dev/null
+++ b/Zend/zend_builtin_functions.stub.php
@@ -0,0 +1,123 @@
+<?php
+
+function zend_version(): string {}
+
+function func_num_args(): int {}
+
+/** @return mixed */
+function func_get_arg(int $arg_num) {}
+
+/** @return array|false */
+function func_get_args() {}
+
+function strlen(string $str): int {}
+
+function strcmp(string $str1, string $str2): int {}
+
+/** @return int|false */
+function strncmp(string $str1, string $str2, int $len) {}
+
+function error_reporting($new_error_level = UNKNOWN): int {}
+
+function define(string $constant_name, $value, bool $case_insensitive = false): bool {}
+
+function defined(string $constant_name): bool {}
+
+/** @return string|false */
+function get_class(object $object = UNKNOWN) {}
+
+/** @return string|false */
+function get_called_class() {}
+
+/** @return string|false */
+function get_parent_class($object = UNKNOWN) {}
+
+function is_subclass_of($object, string $class_name, bool $allow_string = true): bool {}
+
+function is_a($object, string $class_name, bool $allow_string = false): bool {}
+
+/** @return array|false */
+function get_class_vars(string $class_name) {}
+
+function get_object_vars(object $obj): array {}
+
+function get_mangled_object_vars(object $obj): array {}
+
+function get_class_methods($class): ?array {}
+
+function method_exists($object_or_class, string $method): bool {}
+
+function property_exists($object_or_class, string $property_name): ?bool {}
+
+function class_exists(string $classname, bool $autoload = true): bool {}
+
+function interface_exists(string $classname, bool $autoload = true): bool {}
+
+function trait_exists(string $traitname, bool $autoload = true): bool {}
+
+function function_exists(string $function_name): bool {}
+
+function class_alias(string $user_class_name, string $alias_name, bool $autoload = true): bool {}
+
+function get_included_files(): array {}
+
+/** @alias get_included_files */
+function get_required_files(): array {}
+
+function trigger_error(string $message, int $error_type = E_USER_NOTICE): bool {}
+
+/** @alias trigger_error */
+function user_error(string $message, int $error_type = E_USER_NOTICE): bool {}
+
+/** @return mixed */
+function set_error_handler($error_handler, int $error_types = E_ALL) {}
+
+function restore_error_handler(): bool {}
+
+/** @return mixed */
+function set_exception_handler($exception_handler) {}
+
+function restore_exception_handler(): bool {}
+
+function get_declared_classes(): array {}
+
+function get_declared_traits(): array {}
+
+function get_declared_interfaces(): array {}
+
+function get_defined_functions(bool $exclude_disabled = false): array {}
+
+function get_defined_vars(): ?array {}
+
+function get_resource_type($res): string {}
+
+function get_resources(string $type = UNKNOWN): array {}
+
+function get_loaded_extensions(bool $zend_extensions = false): array {}
+
+function get_defined_constants(bool $categorize = false): array {}
+
+function debug_backtrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array {}
+
+function debug_print_backtrace(int $options = 0, int $limit = 0): void {}
+
+function extension_loaded(string $extension_name): bool {}
+
+/** @return array|false */
+function get_extension_funcs(string $extension_name) {}
+
+#if ZEND_DEBUG && defined(ZTS)
+function zend_thread_id(): int {}
+#endif
+
+function gc_mem_caches(): int {}
+
+function gc_collect_cycles(): int {}
+
+function gc_enabled(): bool {}
+
+function gc_enable(): void {}
+
+function gc_disable(): void {}
+
+function gc_status(): array {}
diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h
new file mode 100644
index 0000000000..750b0aa219
--- /dev/null
+++ b/Zend/zend_builtin_functions_arginfo.h
@@ -0,0 +1,198 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_func_num_args, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, arg_num, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_args, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strlen, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcmp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_reporting, 0, 0, IS_LONG, 0)
+ ZEND_ARG_INFO(0, new_error_level)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_define, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, case_insensitive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_called_class arginfo_func_get_args
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_get_parent_class, 0, 0, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_subclass_of, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, allow_string, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_a arginfo_is_subclass_of
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_vars, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_object_vars, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_mangled_object_vars arginfo_get_object_vars
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_class_methods, 0, 1, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, class)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_method_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object_or_class)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_property_exists, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_INFO(0, object_or_class)
+ ZEND_ARG_TYPE_INFO(0, property_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_interface_exists arginfo_class_exists
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trait_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, traitname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_function_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_alias, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, user_class_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, alias_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_included_files, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_required_files arginfo_get_included_files
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trigger_error, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, error_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_user_error arginfo_trigger_error
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
+ ZEND_ARG_INFO(0, error_handler)
+ ZEND_ARG_TYPE_INFO(0, error_types, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_restore_error_handler, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
+ ZEND_ARG_INFO(0, exception_handler)
+ZEND_END_ARG_INFO()
+
+#define arginfo_restore_exception_handler arginfo_restore_error_handler
+
+#define arginfo_get_declared_classes arginfo_get_included_files
+
+#define arginfo_get_declared_traits arginfo_get_included_files
+
+#define arginfo_get_declared_interfaces arginfo_get_included_files
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, exclude_disabled, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_vars, 0, 0, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resource_type, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, res)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resources, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_loaded_extensions, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, zend_extensions, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_constants, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, categorize, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_backtrace, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_print_backtrace, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extension_loaded, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_get_extension_funcs, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if ZEND_DEBUG && defined(ZTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_thread_id, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_gc_mem_caches arginfo_func_num_args
+
+#define arginfo_gc_collect_cycles arginfo_func_num_args
+
+#define arginfo_gc_enabled arginfo_restore_error_handler
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gc_enable, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gc_disable arginfo_gc_enable
+
+#define arginfo_gc_status arginfo_get_included_files
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index de80902852..26184d3d35 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -26,6 +26,7 @@
#include "zend_objects.h"
#include "zend_objects_API.h"
#include "zend_globals.h"
+#include "zend_closures_arginfo.h"
#define ZEND_CLOSURE_PRINT_NAME "Closure object"
@@ -84,12 +85,8 @@ static zend_bool zend_valid_closure_binding(
}
} else if (is_fake_closure && func->common.scope
&& !(func->common.fn_flags & ZEND_ACC_STATIC)) {
- if (func->type == ZEND_INTERNAL_FUNCTION) {
- zend_error(E_WARNING, "Cannot unbind $this of internal method");
- return 0;
- } else {
- zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated");
- }
+ zend_error(E_WARNING, "Cannot unbind $this of method");
+ return 0;
} else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr)
&& (func->common.fn_flags & ZEND_ACC_USES_THIS)) {
// TODO: Only deprecate if it had $this *originally*?
@@ -341,7 +338,7 @@ ZEND_METHOD(Closure, fromCallable)
success = zend_create_closure_from_callable(return_value, callable, &error);
EG(current_execute_data) = execute_data;
- if (success == FAILURE || error) {
+ if (success == FAILURE) {
if (error) {
zend_type_error("Failed to create closure from callable: %s", error);
efree(error);
@@ -359,9 +356,10 @@ static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object
}
/* }}} */
-static int zend_closure_compare_objects(zval *o1, zval *o2) /* {{{ */
+static int zend_closure_compare(zval *o1, zval *o2) /* {{{ */
{
- return (Z_OBJ_P(o1) != Z_OBJ_P(o2));
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+ return Z_OBJ_P(o1) != Z_OBJ_P(o2);
}
/* }}} */
@@ -417,28 +415,28 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
}
/* }}} */
-static ZEND_COLD zval *zend_closure_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_closure_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_closure_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_closure_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return value;
}
/* }}} */
-static ZEND_COLD zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_closure_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
}
/* }}} */
-static ZEND_COLD int zend_closure_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_closure_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
if (has_set_exists != ZEND_PROPERTY_EXISTS) {
ZEND_CLOSURE_PROPERTY_ERROR();
@@ -447,7 +445,7 @@ static ZEND_COLD int zend_closure_has_property(zval *object, zval *member, int h
}
/* }}} */
-static ZEND_COLD void zend_closure_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_closure_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
@@ -483,9 +481,9 @@ static zend_object *zend_closure_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *zend_closure_clone(zval *zobject) /* {{{ */
+static zend_object *zend_closure_clone(zend_object *zobject) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(zobject);
+ zend_closure *closure = (zend_closure *)zobject;
zval result;
zend_create_closure(&result, &closure->func,
@@ -494,9 +492,9 @@ static zend_object *zend_closure_clone(zval *zobject) /* {{{ */
}
/* }}} */
-int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+int zend_closure_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
+ zend_closure *closure = (zend_closure *)obj;
*fptr_ptr = &closure->func;
*ce_ptr = closure->called_scope;
@@ -510,9 +508,9 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
}
/* }}} */
-static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(object);
+ zend_closure *closure = (zend_closure *)object;
zval val;
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
HashTable *debug_info;
@@ -575,9 +573,9 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
}
/* }}} */
-static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */
+static HashTable *zend_closure_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
+ zend_closure *closure = (zend_closure *)obj;
*table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL;
*n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0;
@@ -594,32 +592,12 @@ ZEND_COLD ZEND_METHOD(Closure, __construct)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bindto, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bind, 0, 0, 2)
- ZEND_ARG_INFO(0, closure)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_call, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_fromcallable, 0, 0, 1)
- ZEND_ARG_INFO(0, callable)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry closure_functions[] = {
- ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE)
- ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, fromCallable, arginfo_closure_fromcallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(Closure, __construct, arginfo_class_Closure___construct, ZEND_ACC_PRIVATE)
+ ZEND_ME(Closure, bind, arginfo_class_Closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_MALIAS(Closure, bindTo, bind, arginfo_class_Closure_bindTo, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, call, arginfo_class_Closure_call, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, fromCallable, arginfo_class_Closure_fromCallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
@@ -643,7 +621,7 @@ void zend_register_closure_ce(void) /* {{{ */
closure_handlers.get_property_ptr_ptr = zend_closure_get_property_ptr_ptr;
closure_handlers.has_property = zend_closure_has_property;
closure_handlers.unset_property = zend_closure_unset_property;
- closure_handlers.compare_objects = zend_closure_compare_objects;
+ closure_handlers.compare = zend_closure_compare;
closure_handlers.clone_obj = zend_closure_clone;
closure_handlers.get_debug_info = zend_closure_get_debug_info;
closure_handlers.get_closure = zend_closure_get_closure;
diff --git a/Zend/zend_closures.stub.php b/Zend/zend_closures.stub.php
new file mode 100644
index 0000000000..cc859b2b10
--- /dev/null
+++ b/Zend/zend_closures.stub.php
@@ -0,0 +1,17 @@
+<?php
+
+Class Closure
+{
+ private function __construct() {}
+
+ /** @return ?Closure */
+ static function bind(Closure $closure, ?object $newthis, $newscope = UNKNOWN) {}
+
+ /** @return ?Closure */
+ function bindTo(?object $newthis, $newscope = UNKNOWN) {}
+
+ function call(object $newthis, ...$parameters) {}
+
+ /** @return Closure */
+ function fromCallable(callable $callable) {}
+}
diff --git a/Zend/zend_closures_arginfo.h b/Zend/zend_closures_arginfo.h
new file mode 100644
index 0000000000..91d019dc94
--- /dev/null
+++ b/Zend/zend_closures_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bind, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, closure, Closure, 0)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bindTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_call, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 0)
+ ZEND_ARG_VARIADIC_INFO(0, parameters)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_fromCallable, 0, 0, 1)
+ ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index ce37710dd0..4ac3eaa670 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -71,7 +71,7 @@ static inline uint32_t zend_alloc_cache_slot(void) {
}
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
-ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
+ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename);
#ifndef ZTS
ZEND_API zend_compiler_globals compiler_globals;
@@ -469,17 +469,6 @@ static int lookup_cv(zend_string *name) /* {{{ */{
}
/* }}} */
-void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
-{
- zval_ptr_dtor_nogc(CT_CONSTANT_EX(op_array, n));
- if (n + 1 == op_array->last_literal) {
- op_array->last_literal--;
- } else {
- ZVAL_UNDEF(CT_CONSTANT_EX(op_array, n));
- }
-}
-/* }}} */
-
static inline zend_string *zval_make_interned_string(zval *zv) /* {{{ */
{
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
@@ -599,10 +588,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified)
zend_str_tolower(ZSTR_VAL(tmp_name), ns_len);
zend_add_literal_string(&tmp_name);
- /* lowercased namespace name & lowercased constant name */
- tmp_name = zend_string_tolower(name);
- zend_add_literal_string(&tmp_name);
-
if (!unqualified) {
return ret;
}
@@ -614,11 +599,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified)
tmp_name = zend_string_init(after_ns, after_ns_len, 0);
zend_add_literal_string(&tmp_name);
- /* lowercased unqualified constant name */
- tmp_name = zend_string_alloc(after_ns_len, 0);
- zend_str_tolower_copy(ZSTR_VAL(tmp_name), after_ns, after_ns_len);
- zend_add_literal_string(&tmp_name);
-
return ret;
}
/* }}} */
@@ -691,8 +671,21 @@ void zend_do_free(znode *op1) /* {{{ */
}
if (opline->result_type == IS_TMP_VAR && opline->result.var == op1->u.op.var) {
- if (opline->opcode == ZEND_BOOL || opline->opcode == ZEND_BOOL_NOT) {
- return;
+ switch (opline->opcode) {
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ /* boolean resuls don't have to be freed */
+ return;
+ case ZEND_POST_INC_STATIC_PROP:
+ case ZEND_POST_DEC_STATIC_PROP:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ /* convert $i++ to ++$i */
+ opline->opcode -= 2;
+ opline->result_type = IS_UNUSED;
+ return;
}
}
@@ -1000,10 +993,9 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */
if (op_array->refcount) {
(*op_array->refcount)++;
}
- if (op_array->static_variables) {
- if (!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
- GC_ADDREF(op_array->static_variables);
- }
+ if (op_array->static_variables
+ && !(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
+ GC_ADDREF(op_array->static_variables);
}
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void*)));
@@ -1090,6 +1082,70 @@ ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */
}
/* }}} */
+zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) {
+ zend_bool nullable = ZEND_TYPE_ALLOW_NULL(type);
+ zend_string *str;
+ if (ZEND_TYPE_IS_NAME(type)) {
+ zend_string *name = ZEND_TYPE_NAME(type);
+ if (scope) {
+ if (zend_string_equals_literal_ci(name, "self")) {
+ name = scope->name;
+ } else if (zend_string_equals_literal_ci(name, "parent") && scope->parent) {
+ name = scope->parent->name;
+ }
+ }
+ str = zend_string_copy(name);
+ } else if (ZEND_TYPE_IS_CE(type)) {
+ str = zend_string_copy(ZEND_TYPE_CE(type)->name);
+ } else {
+ uint32_t type_mask = ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(type));
+ switch (type_mask) {
+ case MAY_BE_FALSE|MAY_BE_TRUE:
+ str = ZSTR_KNOWN(ZEND_STR_BOOL);
+ break;
+ case MAY_BE_LONG:
+ str = ZSTR_KNOWN(ZEND_STR_INT);
+ break;
+ case MAY_BE_DOUBLE:
+ str = ZSTR_KNOWN(ZEND_STR_FLOAT);
+ break;
+ case MAY_BE_STRING:
+ str = ZSTR_KNOWN(ZEND_STR_STRING);
+ break;
+ case MAY_BE_ARRAY:
+ str = ZSTR_KNOWN(ZEND_STR_ARRAY);
+ break;
+ case MAY_BE_OBJECT:
+ str = ZSTR_KNOWN(ZEND_STR_OBJECT);
+ break;
+ case MAY_BE_CALLABLE:
+ str = ZSTR_KNOWN(ZEND_STR_CALLABLE);
+ break;
+ case MAY_BE_ITERABLE:
+ str = ZSTR_KNOWN(ZEND_STR_ITERABLE);
+ break;
+ case MAY_BE_VOID:
+ str = ZSTR_KNOWN(ZEND_STR_VOID);
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+ }
+
+ if (nullable) {
+ zend_string *nullable_str = zend_string_alloc(ZSTR_LEN(str) + 1, 0);
+ ZSTR_VAL(nullable_str)[0] = '?';
+ memcpy(ZSTR_VAL(nullable_str) + 1, ZSTR_VAL(str), ZSTR_LEN(str));
+ ZSTR_VAL(nullable_str)[ZSTR_LEN(nullable_str)] = '\0';
+ zend_string_release(str);
+ return nullable_str;
+ }
+ return str;
+}
+
+zend_string *zend_type_to_string(zend_type type) {
+ return zend_type_to_string_resolved(type, NULL);
+}
+
static void zend_mark_function_as_generator() /* {{{ */
{
if (!CG(active_op_array)->function_name) {
@@ -1099,19 +1155,22 @@ static void zend_mark_function_as_generator() /* {{{ */
if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
zend_arg_info return_info = CG(active_op_array)->arg_info[-1];
+ zend_bool valid_type;
+ if (ZEND_TYPE_IS_CLASS(return_info.type)) {
+ zend_string *name = ZEND_TYPE_NAME(return_info.type);
+ valid_type = zend_string_equals_literal_ci(name, "Traversable")
+ || zend_string_equals_literal_ci(name, "Iterator")
+ || zend_string_equals_literal_ci(name, "Generator");
+ } else {
+ valid_type = (ZEND_TYPE_MASK(return_info.type) & MAY_BE_ITERABLE) != 0;
+ }
- if (ZEND_TYPE_CODE(return_info.type) != IS_ITERABLE) {
- const char *msg = "Generators may only declare a return type of Generator, Iterator, Traversable, or iterable, %s is not permitted";
-
- if (!ZEND_TYPE_IS_CLASS(return_info.type)) {
- zend_error_noreturn(E_COMPILE_ERROR, msg, zend_get_type_by_const(ZEND_TYPE_CODE(return_info.type)));
- }
-
- if (!zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Traversable")
- && !zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Iterator")
- && !zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Generator")) {
- zend_error_noreturn(E_COMPILE_ERROR, msg, ZSTR_VAL(ZEND_TYPE_NAME(return_info.type)));
- }
+ if (!valid_type) {
+ zend_string *str = zend_type_to_string(return_info.type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Generators may only declare a return type of " \
+ "Generator, Iterator, Traversable, or iterable, %s is not permitted",
+ ZSTR_VAL(str));
}
}
@@ -1251,26 +1310,13 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char
}
/* }}} */
-static zend_constant *zend_lookup_reserved_const(const char *name, size_t len) /* {{{ */
-{
- zend_constant *c = zend_hash_find_ptr_lc(EG(zend_constants), name, len);
- if (c && !(ZEND_CONSTANT_FLAGS(c) & CONST_CS) && (ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST)) {
- return c;
- }
- return NULL;
-}
-/* }}} */
-
static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool is_fully_qualified) /* {{{ */
{
- zend_constant *c;
-
- /* Substitute case-sensitive (or lowercase) constants */
- c = zend_hash_find_ptr(EG(zend_constants), name);
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
if (c && (
((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)
&& !(CG(compiler_options) & ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION)
- && (!(ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE) || !(CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE)))
+ && !((ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE) && (CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE)))
|| (Z_TYPE(c->value) < IS_OBJECT && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION))
)) {
ZVAL_COPY_OR_DUP(zv, &c->value);
@@ -1281,19 +1327,19 @@ static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool i
/* Substitute true, false and null (including unqualified usage in namespaces) */
const char *lookup_name = ZSTR_VAL(name);
size_t lookup_len = ZSTR_LEN(name);
+ zval *val;
if (!is_fully_qualified) {
zend_get_unqualified_name(name, &lookup_name, &lookup_len);
}
- c = zend_lookup_reserved_const(lookup_name, lookup_len);
- if (c) {
- ZVAL_COPY_OR_DUP(zv, &c->value);
+ if ((val = zend_get_special_const(lookup_name, lookup_len))) {
+ ZVAL_COPY_VALUE(zv, val);
return 1;
}
- }
- return 0;
+ return 0;
+ }
}
/* }}} */
@@ -1362,7 +1408,7 @@ static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
} else if (fetch_type == ZEND_FETCH_CLASS_PARENT && !ce->parent_name) {
- zend_error(E_DEPRECATED,
+ zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use \"parent\" when current class scope has no parent");
}
}
@@ -1924,7 +1970,7 @@ static inline uint32_t zend_emit_jump(uint32_t opnum_target) /* {{{ */
}
/* }}} */
-ZEND_API int zend_is_smart_branch(zend_op *opline) /* {{{ */
+ZEND_API int zend_is_smart_branch(const zend_op *opline) /* {{{ */
{
switch (opline->opcode) {
case ZEND_IS_IDENTICAL:
@@ -1956,12 +2002,18 @@ static inline uint32_t zend_emit_cond_jump(zend_uchar opcode, znode *cond, uint3
uint32_t opnum = get_next_op_number();
zend_op *opline;
- if ((cond->op_type & (IS_CV|IS_CONST))
- && opnum > 0
- && zend_is_smart_branch(CG(active_op_array)->opcodes + opnum - 1)) {
- /* emit extra NOP to avoid incorrect SMART_BRANCH in very rare cases */
- zend_emit_op(NULL, ZEND_NOP, NULL, NULL);
- opnum = get_next_op_number();
+ if (cond->op_type == IS_TMP_VAR && opnum > 0) {
+ opline = CG(active_op_array)->opcodes + opnum - 1;
+ if (opline->result_type == IS_TMP_VAR
+ && opline->result.var == cond->u.op.var
+ && zend_is_smart_branch(opline)) {
+ if (opcode == ZEND_JMPZ) {
+ opline->result_type = IS_TMP_VAR | IS_SMART_BRANCH_JMPZ;
+ } else {
+ ZEND_ASSERT(opcode == ZEND_JMPNZ);
+ opline->result_type = IS_TMP_VAR | IS_SMART_BRANCH_JMPNZ;
+ }
+ }
}
opline = zend_emit_op(NULL, opcode, cond, NULL);
opline->op2.opline_num = opnum_target;
@@ -2081,11 +2133,12 @@ static void zend_compile_memoized_expr(znode *result, zend_ast *expr) /* {{{ */
static void zend_emit_return_type_check(
znode *expr, zend_arg_info *return_info, zend_bool implicit) /* {{{ */
{
- if (ZEND_TYPE_IS_SET(return_info->type)) {
+ zend_type type = return_info->type;
+ if (ZEND_TYPE_IS_SET(type)) {
zend_op *opline;
/* `return ...;` is illegal in a void function (but `return;` isn't) */
- if (ZEND_TYPE_CODE(return_info->type) == IS_VOID) {
+ if (ZEND_TYPE_IS_MASK(type) && ZEND_TYPE_CONTAINS_CODE(type, IS_VOID)) {
if (expr) {
if (expr->op_type == IS_CONST && Z_TYPE(expr->u.constant) == IS_NULL) {
zend_error_noreturn(E_COMPILE_ERROR,
@@ -2100,7 +2153,7 @@ static void zend_emit_return_type_check(
}
if (!expr && !implicit) {
- if (ZEND_TYPE_ALLOW_NULL(return_info->type)) {
+ if (ZEND_TYPE_ALLOW_NULL(type)) {
zend_error_noreturn(E_COMPILE_ERROR,
"A function with return type must return a value "
"(did you mean \"return null;\" instead of \"return;\"?)");
@@ -2111,12 +2164,8 @@ static void zend_emit_return_type_check(
}
if (expr && expr->op_type == IS_CONST) {
- if ((ZEND_TYPE_CODE(return_info->type) == Z_TYPE(expr->u.constant))
- ||((ZEND_TYPE_CODE(return_info->type) == _IS_BOOL)
- && (Z_TYPE(expr->u.constant) == IS_FALSE
- || Z_TYPE(expr->u.constant) == IS_TRUE))
- || (ZEND_TYPE_ALLOW_NULL(return_info->type)
- && Z_TYPE(expr->u.constant) == IS_NULL)) {
+ if (ZEND_TYPE_IS_MASK(type)
+ && ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE(expr->u.constant))) {
/* we don't need run-time check */
return;
}
@@ -2486,10 +2535,6 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
CG(active_op_array)->fn_flags |= ZEND_ACC_USES_THIS;
} else {
opline = zend_delayed_compile_var(&obj_node, obj_ast, type, 0);
- if (opline && type == BP_VAR_W && (opline->opcode == ZEND_FETCH_STATIC_PROP_W || opline->opcode == ZEND_FETCH_OBJ_W)) {
- opline->extended_value |= ZEND_FETCH_OBJ_WRITE;
- }
-
zend_separate_if_call_and_write(&obj_node, obj_ast, type);
}
zend_compile_expr(&prop_node, prop_ast);
@@ -2986,26 +3031,26 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
}
arg_count++;
- if (zend_is_variable_or_call(arg)) {
- if (zend_is_call(arg)) {
- zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
- if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
- /* Function call was converted into builtin instruction */
- opcode = ZEND_SEND_VAL;
- } else {
- if (fbc) {
- if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
- opcode = ZEND_SEND_VAR_NO_REF;
- } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
- opcode = ZEND_SEND_VAL;
- } else {
- opcode = ZEND_SEND_VAR;
- }
+ if (zend_is_call(arg)) {
+ zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
+ if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
+ /* Function call was converted into builtin instruction */
+ opcode = ZEND_SEND_VAL;
+ } else {
+ if (fbc) {
+ if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
+ opcode = ZEND_SEND_VAR_NO_REF;
+ } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
+ opcode = ZEND_SEND_VAL;
} else {
- opcode = ZEND_SEND_VAR_NO_REF_EX;
+ opcode = ZEND_SEND_VAR;
}
+ } else {
+ opcode = ZEND_SEND_VAR_NO_REF_EX;
}
- } else if (fbc) {
+ }
+ } else if (zend_is_variable(arg)) {
+ if (fbc) {
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
zend_compile_var(&arg_node, arg, BP_VAR_W, 1);
opcode = ZEND_SEND_REF;
@@ -3084,7 +3129,7 @@ ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc)
if (fbc) {
if (fbc->type == ZEND_INTERNAL_FUNCTION && !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) {
if (init_op->opcode == ZEND_INIT_FCALL && !zend_execute_internal) {
- if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_RETURN_REFERENCE))) {
+ if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED))) {
return ZEND_DO_ICALL;
} else {
return ZEND_DO_FCALL_BY_NAME;
@@ -3203,9 +3248,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */
{
znode arg_node;
- if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)
- || args->children != 1
- ) {
+ if (args->children != 1) {
return FAILURE;
}
@@ -3251,8 +3294,12 @@ int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /*
}
zend_compile_expr(&arg_node, args->child[0]);
- opline = zend_emit_op_tmp(result, ZEND_CAST, &arg_node, NULL);
- opline->extended_value = type;
+ if (type == _IS_BOOL) {
+ opline = zend_emit_op_tmp(result, ZEND_BOOL, &arg_node, NULL);
+ } else {
+ opline = zend_emit_op_tmp(result, ZEND_CAST, &arg_node, NULL);
+ opline->extended_value = type;
+ }
return SUCCESS;
}
/* }}} */
@@ -3285,13 +3332,6 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */
LITERAL_STR(opline->op1, name);
opline->extended_value = zend_alloc_cache_slot();
- /* Lowercase constant name in a separate literal */
- {
- zval c;
- zend_string *lcname = zend_string_tolower(name);
- ZVAL_NEW_STR(&c, lcname);
- zend_add_literal(&c);
- }
return SUCCESS;
}
/* }}} */
@@ -3934,6 +3974,24 @@ static zend_bool zend_is_constructor(zend_string *name) /* {{{ */
}
/* }}} */
+static zend_function *zend_get_compatible_func_or_null(zend_class_entry *ce, zend_string *lcname) /* {{{ */
+{
+ zend_function *fbc = zend_hash_find_ptr(&ce->function_table, lcname);
+ if (!fbc || (fbc->common.fn_flags & ZEND_ACC_PUBLIC) || ce == CG(active_class_entry)) {
+ return fbc;
+ }
+
+ if (!(fbc->common.fn_flags & ZEND_ACC_PRIVATE)
+ && (fbc->common.scope->ce_flags & ZEND_ACC_LINKED)
+ && (!CG(active_class_entry) || (CG(active_class_entry)->ce_flags & ZEND_ACC_LINKED))
+ && zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry))) {
+ return fbc;
+ }
+
+ return NULL;
+}
+/* }}} */
+
void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
{
zend_ast *class_ast = ast->child[0];
@@ -3992,18 +4050,7 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
}
if (ce) {
zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
- fbc = zend_hash_find_ptr(&ce->function_table, lcname);
- if (fbc && !(fbc->common.fn_flags & ZEND_ACC_PUBLIC)) {
- if (ce != CG(active_class_entry)
- && ((fbc->common.fn_flags & ZEND_ACC_PRIVATE)
- || !(fbc->common.scope->ce_flags & ZEND_ACC_LINKED)
- || (CG(active_class_entry)
- && !(CG(active_class_entry)->ce_flags & ZEND_ACC_LINKED))
- || !zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry)))) {
- /* incompatibe function */
- fbc = NULL;
- }
- }
+ fbc = zend_get_compatible_func_or_null(ce, lcname);
}
}
@@ -5280,7 +5327,7 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
}
if (ast->kind == ZEND_AST_TYPE) {
- return ZEND_TYPE_ENCODE(ast->attr, allow_null);
+ return ZEND_TYPE_ENCODE_CODE(ast->attr, allow_null);
} else {
zend_string *class_name = zend_ast_get_str(ast);
zend_uchar type = zend_lookup_builtin_type_by_name(class_name);
@@ -5291,7 +5338,10 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
"Type declaration '%s' must be unqualified",
ZSTR_VAL(zend_string_tolower(class_name)));
}
- return ZEND_TYPE_ENCODE(type, allow_null);
+ if (type == IS_VOID && allow_null) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Void type cannot be nullable");
+ }
+ return ZEND_TYPE_ENCODE_CODE(type, allow_null);
} else {
uint32_t fetch_type = zend_get_class_fetch_type_ast(ast);
if (fetch_type == ZEND_FETCH_CLASS_DEFAULT) {
@@ -5308,6 +5358,31 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
}
/* }}} */
+/* May convert value from int to float. */
+static zend_bool zend_is_valid_default_value(zend_type type, zval *value)
+{
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(type));
+ if (Z_TYPE_P(value) == IS_NULL && ZEND_TYPE_ALLOW_NULL(type)) {
+ return 1;
+ }
+
+ if (ZEND_TYPE_IS_CLASS(type)) {
+ return 0;
+ }
+ if (ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE_P(value))) {
+ return 1;
+ }
+ if ((ZEND_TYPE_MASK(type) & MAY_BE_DOUBLE) && Z_TYPE_P(value) == IS_LONG) {
+ /* Integers are allowed as initializers for floating-point values. */
+ convert_to_double(value);
+ return 1;
+ }
+ if ((ZEND_TYPE_MASK(type) & MAY_BE_ITERABLE) && Z_TYPE_P(value) == IS_ARRAY) {
+ return 1;
+ }
+ return 0;
+}
+
void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -5322,11 +5397,6 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
arg_infos->pass_by_reference = (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
arg_infos->is_variadic = 0;
arg_infos->type = zend_compile_typename(return_type_ast, 0);
-
- if (ZEND_TYPE_CODE(arg_infos->type) == IS_VOID && ZEND_TYPE_ALLOW_NULL(arg_infos->type)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Void type cannot be nullable");
- }
-
arg_infos++;
op_array->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE;
} else {
@@ -5396,73 +5466,31 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
arg_info->name = zend_string_copy(name);
arg_info->pass_by_reference = is_ref;
arg_info->is_variadic = is_variadic;
- /* TODO: Keep compatibility, but may be better reset "allow_null" ??? */
- arg_info->type = ZEND_TYPE_ENCODE(0, 1);
+ arg_info->type = ZEND_TYPE_ENCODE_NONE();
if (type_ast) {
- zend_bool has_null_default = default_ast
- && (Z_TYPE(default_node.u.constant) == IS_NULL
- || (Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST
- && Z_ASTVAL(default_node.u.constant)->kind == ZEND_AST_CONSTANT
- && strcasecmp(ZSTR_VAL(zend_ast_get_constant_name(Z_ASTVAL(default_node.u.constant))), "NULL") == 0));
+ uint32_t default_type = default_ast ? Z_TYPE(default_node.u.constant) : IS_UNDEF;
+
+ uint32_t arg_type;
+ zend_bool is_class;
op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
- arg_info->type = zend_compile_typename(type_ast, has_null_default);
+ arg_info->type = zend_compile_typename(type_ast, default_type == IS_NULL);
+
+ is_class = ZEND_TYPE_IS_CLASS(arg_info->type);
+ arg_type = !is_class ? ZEND_TYPE_MASK(arg_info->type) : 0;
- if (ZEND_TYPE_CODE(arg_info->type) == IS_VOID) {
+ if (arg_type & MAY_BE_VOID) {
zend_error_noreturn(E_COMPILE_ERROR, "void cannot be used as a parameter type");
}
- if (type_ast->kind == ZEND_AST_TYPE) {
- if (ZEND_TYPE_CODE(arg_info->type) == IS_ARRAY) {
- if (default_ast && !has_null_default
- && Z_TYPE(default_node.u.constant) != IS_ARRAY
- && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST
- ) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with array type can only be an array or NULL");
- }
- } else if (ZEND_TYPE_CODE(arg_info->type) == IS_CALLABLE && default_ast) {
- if (!has_null_default && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with callable type can only be NULL");
- }
- }
- } else {
- if (default_ast && !has_null_default && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST) {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a class type can only be NULL");
- } else switch (ZEND_TYPE_CODE(arg_info->type)) {
- case IS_DOUBLE:
- if (Z_TYPE(default_node.u.constant) != IS_DOUBLE && Z_TYPE(default_node.u.constant) != IS_LONG) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a float type can only be float, integer, or NULL");
- }
- convert_to_double(&default_node.u.constant);
- break;
-
- case IS_ITERABLE:
- if (Z_TYPE(default_node.u.constant) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with iterable type can only be an array or NULL");
- }
- break;
-
- case IS_OBJECT:
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with an object type can only be NULL");
- break;
-
- default:
- if (!ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(arg_info->type), Z_TYPE(default_node.u.constant))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a %s type can only be %s or NULL",
- zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)), zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)));
- }
- break;
- }
- }
+ if (default_type > IS_NULL && default_type != IS_CONSTANT_AST
+ && !zend_is_valid_default_value(arg_info->type, &default_node.u.constant)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use %s as default value for parameter $%s of type %s",
+ zend_get_type_by_const(default_type),
+ ZSTR_VAL(name), ZSTR_VAL(type_str));
}
}
@@ -5472,21 +5500,8 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
if (type_ast) {
/* Allocate cache slot to speed-up run-time class resolution */
- if (opline->opcode == ZEND_RECV_INIT) {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- opline->extended_value = zend_alloc_cache_slot();
- }
- } else {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- opline->op2.num = op_array->cache_size;
- op_array->cache_size += sizeof(void*);
- } else {
- opline->op2.num = -1;
- }
- }
- } else {
- if (opline->opcode != ZEND_RECV_INIT) {
- opline->op2.num = -1;
+ if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
+ opline->extended_value = zend_alloc_cache_slot();
}
}
}
@@ -5688,18 +5703,30 @@ static void zend_compile_implicit_closure_uses(closure_info *info)
ZEND_HASH_FOREACH_END();
}
+static void zend_check_magic_method_attr(uint32_t attr, const char* method, zend_bool is_static) /* {{{ */
+{
+ if (is_static) {
+ if (!(attr & ZEND_ACC_PUBLIC) || !(attr & ZEND_ACC_STATIC)) {
+ zend_error(E_WARNING, "The magic method %s() must have public visibility and be static", method);
+ }
+ } else if (!(attr & ZEND_ACC_PUBLIC) || (attr & ZEND_ACC_STATIC)) {
+ zend_error(E_WARNING,
+ "The magic method %s() must have public visibility and cannot be static",
+ method);
+ }
+}
+/* }}} */
+
void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_bool has_body) /* {{{ */
{
zend_class_entry *ce = CG(active_class_entry);
zend_bool in_interface = (ce->ce_flags & ZEND_ACC_INTERFACE) != 0;
- zend_bool in_trait = (ce->ce_flags & ZEND_ACC_TRAIT) != 0;
- zend_bool is_public = (op_array->fn_flags & ZEND_ACC_PUBLIC) != 0;
- zend_bool is_static = (op_array->fn_flags & ZEND_ACC_STATIC) != 0;
+ uint32_t fn_flags = op_array->fn_flags;
zend_string *lcname;
if (in_interface) {
- if (!is_public || (op_array->fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_ABSTRACT))) {
+ if (!(fn_flags & ZEND_ACC_PUBLIC) || (fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_ABSTRACT))) {
zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method "
"%s::%s() must be omitted", ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
@@ -5734,134 +5761,48 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
- if (in_interface) {
- if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
- /* pass */
- } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __call() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
- if (!is_public || !is_static) {
- zend_error(E_WARNING, "The magic method __callStatic() must have "
- "public visibility and be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __get() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __set() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __unset() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __isset() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __toString() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __invoke() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have "
- "public visibility and cannot be static");
- }
- }
- } else {
- if (!in_trait && zend_string_equals_ci(lcname, ce->name)) {
- if (!ce->constructor) {
- ce->constructor = (zend_function *) op_array;
- }
- } else if (zend_string_equals_literal(lcname, "serialize")) {
- ce->serialize_func = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, "unserialize")) {
- ce->unserialize_func = (zend_function *) op_array;
- } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
- if (!is_static) {
- op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;
- }
- } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
- ce->constructor = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) {
- ce->destructor = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
- ce->clone = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __call() must have "
- "public visibility and cannot be static");
- }
- ce->__call = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
- if (!is_public || !is_static) {
- zend_error(E_WARNING, "The magic method __callStatic() must have "
- "public visibility and be static");
- }
- ce->__callstatic = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __get() must have "
- "public visibility and cannot be static");
- }
- ce->__get = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __set() must have "
- "public visibility and cannot be static");
- }
- ce->__set = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __unset() must have "
- "public visibility and cannot be static");
- }
- ce->__unset = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __isset() must have "
- "public visibility and cannot be static");
- }
- ce->__isset = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __toString() must have "
- "public visibility and cannot be static");
- }
- ce->__tostring = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __invoke() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have "
- "public visibility and cannot be static");
- }
- ce->__debugInfo = (zend_function *) op_array;
- } else if (!is_static) {
- op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;
- }
+ if (zend_string_equals_literal(lcname, "serialize")) {
+ ce->serialize_func = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, "unserialize")) {
+ ce->unserialize_func = (zend_function *) op_array;
+ } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
+ /* pass */
+ } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
+ ce->constructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) {
+ ce->destructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
+ ce->clone = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__call", 0);
+ ce->__call = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__callStatic", 1);
+ ce->__callstatic = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__get", 0);
+ ce->__get = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__set", 0);
+ ce->__set = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__unset", 0);
+ ce->__unset = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__isset", 0);
+ ce->__isset = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__toString", 0);
+ ce->__tostring = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__invoke", 0);
+ } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__debugInfo", 0);
+ ce->__debugInfo = (zend_function *) op_array;
}
zend_string_release_ex(lcname, 0);
@@ -5870,7 +5811,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
{
- zend_ast *params_ast = decl->child[0];
zend_string *unqualified_name, *name, *lcname, *key;
zend_op *opline;
@@ -5887,18 +5827,14 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
}
}
- if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) {
- if (zend_ast_get_list(params_ast)->children != 1) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
- ZEND_AUTOLOAD_FUNC_NAME);
- }
-
- zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead");
+ if (zend_string_equals_literal(lcname, "__autoload")) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "__autoload() is no longer supported, use spl_autoload_register() instead");
}
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
- zend_error(E_DEPRECATED,
- "Defining a custom assert() function is deprecated, "
+ zend_error(E_COMPILE_ERROR,
+ "Defining a custom assert() function is not allowed, "
"as the function has special semantics");
}
@@ -6067,17 +6003,17 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags) /
zend_string *name = zval_make_interned_string(zend_ast_get_zval(name_ast));
zend_string *doc_comment = NULL;
zval value_zv;
- zend_type type = 0;
+ zend_type type = ZEND_TYPE_ENCODE_NONE();
if (type_ast) {
type = zend_compile_typename(type_ast, 0);
- if (ZEND_TYPE_CODE(type) == IS_VOID || ZEND_TYPE_CODE(type) == IS_CALLABLE) {
+ if (ZEND_TYPE_IS_MASK(type)
+ && (ZEND_TYPE_MASK(type) & (MAY_BE_VOID|MAY_BE_CALLABLE))) {
+ zend_string *str = zend_type_to_string(type);
zend_error_noreturn(E_COMPILE_ERROR,
"Property %s::$%s cannot have type %s",
- ZSTR_VAL(ce->name),
- ZSTR_VAL(name),
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
+ ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str));
}
}
@@ -6100,36 +6036,19 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags) /
if (value_ast) {
zend_const_expr_to_zval(&value_zv, value_ast);
- if (ZEND_TYPE_IS_SET(type) && !Z_CONSTANT(value_zv)) {
+ if (ZEND_TYPE_IS_SET(type) && !Z_CONSTANT(value_zv)
+ && !zend_is_valid_default_value(type, &value_zv)) {
+ zend_string *str = zend_type_to_string(type);
if (Z_TYPE(value_zv) == IS_NULL) {
- if (!ZEND_TYPE_ALLOW_NULL(type)) {
- const char *name = ZEND_TYPE_IS_CLASS(type)
- ? ZSTR_VAL(ZEND_TYPE_NAME(type)) : zend_get_type_by_const(ZEND_TYPE_CODE(type));
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s may not be null. "
- "Use the nullable type ?%s to allow null default value",
- name, name);
- }
- } else if (ZEND_TYPE_IS_CLASS(type)) {
zend_error_noreturn(E_COMPILE_ERROR,
- "Property of type %s may not have default value", ZSTR_VAL(ZEND_TYPE_NAME(type)));
- } else if (ZEND_TYPE_CODE(type) == IS_ARRAY || ZEND_TYPE_CODE(type) == IS_ITERABLE) {
- if (Z_TYPE(value_zv) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s can only be an array",
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
- }
- } else if (ZEND_TYPE_CODE(type) == IS_DOUBLE) {
- if (Z_TYPE(value_zv) != IS_DOUBLE && Z_TYPE(value_zv) != IS_LONG) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type float can only be float or int");
- }
- convert_to_double(&value_zv);
- } else if (!ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(type), Z_TYPE(value_zv))) {
+ "Default value for property of type %s may not be null. "
+ "Use the nullable type ?%s to allow null default value",
+ ZSTR_VAL(str), ZSTR_VAL(str));
+ } else {
zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s can only be %s",
- zend_get_type_by_const(ZEND_TYPE_CODE(type)),
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
+ "Cannot use %s as default value for property %s::$%s of type %s",
+ zend_get_type_by_const(Z_TYPE(value_zv)),
+ ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str));
}
}
} else if (!ZEND_TYPE_IS_SET(type)) {
@@ -6152,6 +6071,18 @@ void zend_compile_prop_group(zend_ast *list) /* {{{ */
}
/* }}} */
+static void zend_check_const_and_trait_alias_attr(uint32_t attr, const char* entity) /* {{{ */
+{
+ if (attr & ZEND_ACC_STATIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as %s modifier", entity);
+ } else if (attr & ZEND_ACC_ABSTRACT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as %s modifier", entity);
+ } else if (attr & ZEND_ACC_FINAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as %s modifier", entity);
+ }
+}
+/* }}} */
+
void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -6173,13 +6104,7 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
zval value_zv;
if (UNEXPECTED(ast->attr & (ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_FINAL))) {
- if (ast->attr & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as constant modifier");
- } else if (ast->attr & ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as constant modifier");
- } else if (ast->attr & ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as constant modifier");
- }
+ zend_check_const_and_trait_alias_attr(ast->attr, "constant");
}
zend_const_expr_to_zval(&value_zv, value_ast);
@@ -6231,13 +6156,7 @@ static void zend_compile_trait_alias(zend_ast *ast) /* {{{ */
zend_trait_alias *alias;
- if (modifiers == ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier");
- } else if (modifiers == ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier");
- } else if (modifiers == ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier");
- }
+ zend_check_const_and_trait_alias_attr(modifiers, "method");
alias = emalloc(sizeof(zend_trait_alias));
zend_compile_method_ref(method_ref_ast, &alias->trait_method);
@@ -6440,11 +6359,6 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
/* Reset lineno for final opcodes and errors */
CG(zend_lineno) = ast->lineno;
- if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) {
- /* For traits this check is delayed until after trait binding */
- zend_check_deprecated_constructor(ce);
- }
-
if (ce->constructor) {
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
@@ -6513,13 +6427,11 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
}
CG(zend_lineno) = ast->lineno;
}
- } else {
- if (EXPECTED(zend_hash_add_ptr(CG(class_table), lcname, ce) != NULL)) {
- zend_string_release(lcname);
- zend_build_properties_info_table(ce);
- ce->ce_flags |= ZEND_ACC_LINKED;
- return NULL;
- }
+ } else if (EXPECTED(zend_hash_add_ptr(CG(class_table), lcname, ce) != NULL)) {
+ zend_string_release(lcname);
+ zend_build_properties_info_table(ce);
+ ce->ce_flags |= ZEND_ACC_LINKED;
+ return NULL;
}
}
@@ -6688,10 +6600,8 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
}
zend_string_efree(ns_name);
- } else {
- if (zend_have_seen_symbol(lookup_name, type)) {
- zend_check_already_in_use(type, old_name, new_name, lookup_name);
- }
+ } else if (zend_have_seen_symbol(lookup_name, type)) {
+ zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
zend_string_addref(old_name);
@@ -6744,7 +6654,7 @@ void zend_compile_const_decl(zend_ast *ast) /* {{{ */
value_node.op_type = IS_CONST;
zend_const_expr_to_zval(value_zv, value_ast);
- if (zend_lookup_reserved_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
+ if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name));
}
@@ -7157,12 +7067,10 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Illegal offset type");
break;
}
- } else {
- if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
- zval_ptr_dtor_nogc(value);
- zval_ptr_dtor(result);
- return 0;
- }
+ } else if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
+ zval_ptr_dtor_nogc(value);
+ zval_ptr_dtor(result);
+ return 0;
}
}
@@ -7176,16 +7084,6 @@ void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */
zend_ast *right_ast = ast->child[1];
uint32_t opcode = ast->attr;
- if ((opcode == ZEND_ADD || opcode == ZEND_SUB) && left_ast->kind == ZEND_AST_BINARY_OP && left_ast->attr == ZEND_CONCAT) {
- zend_error(E_DEPRECATED, "The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence");
- }
- if ((opcode == ZEND_SL || opcode == ZEND_SR) && ((left_ast->kind == ZEND_AST_BINARY_OP && left_ast->attr == ZEND_CONCAT) || (right_ast->kind == ZEND_AST_BINARY_OP && right_ast->attr == ZEND_CONCAT))) {
- zend_error(E_DEPRECATED, "The behavior of unparenthesized expressions containing both '.' and '>>'/'<<' will change in PHP 8: '<<'/'>>' will take a higher precedence");
- }
- if (opcode == ZEND_PARENTHESIZED_CONCAT) {
- opcode = ZEND_CONCAT;
- }
-
znode left_node, right_node;
zend_compile_expr(&left_node, left_ast);
zend_compile_expr(&right_node, right_ast);
@@ -7308,12 +7206,11 @@ void zend_compile_unary_pm(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&expr_node, expr_ast);
- if (expr_node.op_type == IS_CONST) {
- if (zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) {
- result->op_type = IS_CONST;
- zval_ptr_dtor(&expr_node.u.constant);
- return;
- }
+ if (expr_node.op_type == IS_CONST
+ && zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) {
+ result->op_type = IS_CONST;
+ zval_ptr_dtor(&expr_node.u.constant);
+ return;
}
lefthand_node.op_type = IS_CONST;
@@ -7432,11 +7329,13 @@ void zend_compile_cast(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&expr_node, expr_ast);
- opline = zend_emit_op_tmp(result, ZEND_CAST, &expr_node, NULL);
- opline->extended_value = ast->attr;
-
- if (ast->attr == IS_NULL) {
- zend_error(E_DEPRECATED, "The (unset) cast is deprecated");
+ if (ast->attr == _IS_BOOL) {
+ opline = zend_emit_op_tmp(result, ZEND_BOOL, &expr_node, NULL);
+ } else if (ast->attr == IS_NULL) {
+ zend_error(E_COMPILE_ERROR, "The (unset) cast is no longer supported");
+ } else {
+ opline = zend_emit_op_tmp(result, ZEND_CAST, &expr_node, NULL);
+ opline->extended_value = ast->attr;
}
}
/* }}} */
@@ -7989,19 +7888,13 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, NULL);
opline->op2_type = IS_CONST;
- if (is_fully_qualified) {
+ if (is_fully_qualified || !FC(current_namespace)) {
opline->op2.constant = zend_add_const_name_literal(
resolved_name, 0);
} else {
- opline->op1.num = IS_CONSTANT_UNQUALIFIED;
- if (FC(current_namespace)) {
- opline->op1.num |= IS_CONSTANT_IN_NAMESPACE;
- opline->op2.constant = zend_add_const_name_literal(
- resolved_name, 1);
- } else {
- opline->op2.constant = zend_add_const_name_literal(
- resolved_name, 0);
- }
+ opline->op1.num = IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE;
+ opline->op2.constant = zend_add_const_name_literal(
+ resolved_name, 1);
}
opline->extended_value = zend_alloc_cache_slot();
}
@@ -8332,7 +8225,8 @@ void zend_compile_const_expr_const(zend_ast **ast_ptr) /* {{{ */
}
zend_ast_destroy(ast);
- *ast_ptr = zend_ast_create_constant(resolved_name, !is_fully_qualified ? IS_CONSTANT_UNQUALIFIED : 0);
+ *ast_ptr = zend_ast_create_constant(resolved_name,
+ !is_fully_qualified && FC(current_namespace) ? IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE : 0);
}
/* }}} */
@@ -8781,11 +8675,10 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
int i;
for (i = 0; i <= 1; i++) {
zend_eval_const_expr(&ast->child[i]);
- if (ast->child[i]->kind == ZEND_AST_ZVAL) {
- if (zend_is_true(zend_ast_get_zval(ast->child[i])) == (ast->kind == ZEND_AST_OR)) {
- ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
- return;
- }
+ if (ast->child[i]->kind == ZEND_AST_ZVAL
+ && zend_is_true(zend_ast_get_zval(ast->child[i])) == (ast->kind == ZEND_AST_OR)) {
+ ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
+ return;
}
}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 499d0d64b6..b0ed47ddff 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -206,7 +206,7 @@ typedef struct _zend_oparray_context {
/* Property or method overrides private one | | | */
#define ZEND_ACC_CHANGED (1 << 3) /* | X | X | */
/* | | | */
-/* Staic method or property | | | */
+/* Static method or property | | | */
#define ZEND_ACC_STATIC (1 << 4) /* | X | X | */
/* | | | */
/* Final class or method | | | */
@@ -237,10 +237,10 @@ typedef struct _zend_oparray_context {
#define ZEND_ACC_TRAIT (1 << 1) /* X | | | */
#define ZEND_ACC_ANON_CLASS (1 << 2) /* X | | | */
/* | | | */
-/* Class linked with parent, interfacs and traits | | | */
+/* Class linked with parent, interfaces and traits | | | */
#define ZEND_ACC_LINKED (1 << 3) /* X | | | */
/* | | | */
-/* class is abstarct, since it is set by any | | | */
+/* Class is abstract, since it is set by any | | | */
/* abstract method | | | */
#define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS (1 << 4) /* X | | | */
/* | | | */
@@ -284,7 +284,7 @@ typedef struct _zend_oparray_context {
/* Whether this class was used in its unlinked state. | | | */
#define ZEND_ACC_HAS_UNLINKED_USES (1 << 23) /* X | | | */
/* | | | */
-/* Function Flags (unused: 23, 26) | | | */
+/* Function Flags (unused: 17, 23, 26) | | | */
/* ============== | | | */
/* | | | */
/* deprecation flag | | | */
@@ -306,10 +306,6 @@ typedef struct _zend_oparray_context {
/* ZEND_DECLARE_CLASS_DELAYED opcodes | | | */
#define ZEND_ACC_EARLY_BINDING (1 << 16) /* | X | | */
/* | | | */
-/* method flag (bc only), any method that has this | | | */
-/* flag can be used statically and non statically. | | | */
-#define ZEND_ACC_ALLOW_STATIC (1 << 17) /* | X | | */
-/* | | | */
/* call through user function trampoline. e.g. | | | */
/* __call, __callstatic | | | */
#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 18) /* | X | | */
@@ -493,7 +489,7 @@ union _zend_function {
zend_function *prototype;
uint32_t num_args;
uint32_t required_num_args;
- zend_arg_info *arg_info;
+ zend_arg_info *arg_info; /* index -1 represents the return value info, if any */
} common;
zend_op_array op_array;
@@ -706,6 +702,10 @@ struct _zend_execute_data {
#define IS_VAR (1<<2)
#define IS_CV (1<<3) /* Compiled variable */
+/* Used for result.type of smart branch instructions */
+#define IS_SMART_BRANCH_JMPZ (1<<4)
+#define IS_SMART_BRANCH_JMPNZ (1<<5)
+
#define ZEND_EXTRA_VALUE 1
#include "zend_globals.h"
@@ -722,7 +722,7 @@ void zend_file_context_begin(zend_file_context *prev_context);
void zend_file_context_end(zend_file_context *prev_context);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
-extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
+extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename);
ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem);
void startup_scanner(void);
@@ -780,7 +780,7 @@ ZEND_API void function_add_ref(zend_function *function);
/* helper functions in zend_language_scanner.l */
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type);
-ZEND_API zend_op_array *compile_string(zval *source_string, char *filename);
+ZEND_API zend_op_array *compile_string(zval *source_string, const char *filename);
ZEND_API zend_op_array *compile_filename(int type, zval *filename);
ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle);
@@ -830,7 +830,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers);
uint32_t zend_get_class_fetch_type(zend_string *name);
ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc);
-ZEND_API int zend_is_smart_branch(zend_op *opline);
+ZEND_API int zend_is_smart_branch(const zend_op *opline);
typedef zend_bool (*zend_auto_global_callback)(zend_string *name);
typedef struct _zend_auto_global {
@@ -851,6 +851,9 @@ int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem);
void zend_assert_valid_class_name(const zend_string *const_name);
+zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope);
+zend_string *zend_type_to_string(zend_type type);
+
/* BEGIN: OPCODES */
#include "zend_vm_opcodes.h"
@@ -893,14 +896,11 @@ void zend_assert_valid_class_name(const zend_string *const_name);
#define BP_VAR_FUNC_ARG 4
#define BP_VAR_UNSET 5
-#define ZEND_INTERNAL_FUNCTION 1
-#define ZEND_USER_FUNCTION 2
-#define ZEND_OVERLOADED_FUNCTION 3
-#define ZEND_EVAL_CODE 4
-#define ZEND_OVERLOADED_FUNCTION_TEMPORARY 5
+#define ZEND_INTERNAL_FUNCTION 1
+#define ZEND_USER_FUNCTION 2
+#define ZEND_EVAL_CODE 4
-/* A quick check (type == ZEND_USER_FUNCTION || type == ZEND_EVAL_CODE) */
-#define ZEND_USER_CODE(type) ((type & 1) == 0)
+#define ZEND_USER_CODE(type) ((type) != ZEND_INTERNAL_FUNCTION)
#define ZEND_INTERNAL_CLASS 1
#define ZEND_USER_CLASS 2
@@ -921,7 +921,6 @@ void zend_assert_valid_class_name(const zend_string *const_name);
/* Only one of these can ever be in use */
#define ZEND_FETCH_REF 1
#define ZEND_FETCH_DIM_WRITE 2
-#define ZEND_FETCH_OBJ_WRITE 3
#define ZEND_FETCH_OBJ_FLAGS 3
#define ZEND_ISEMPTY (1<<0)
@@ -938,9 +937,9 @@ void zend_assert_valid_class_name(const zend_string *const_name);
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
-#define IS_CONSTANT_UNQUALIFIED 0x010
-#define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */
-#define IS_CONSTANT_IN_NAMESPACE 0x100
+/* Make sure these don't clash with ZEND_FETCH_CLASS_* flags. */
+#define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */
+#define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x800
static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask)
{
@@ -1018,11 +1017,11 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
(((opcode) >= ZEND_ADD) && ((opcode) <= ZEND_POW))
/* Pseudo-opcodes that are used only temporarily during compilation */
-#define ZEND_PARENTHESIZED_CONCAT 252 /* removed with PHP 8 */
#define ZEND_GOTO 253
#define ZEND_BRK 254
#define ZEND_CONT 255
+
END_EXTERN_C()
#define ZEND_CLONE_FUNC_NAME "__clone"
@@ -1035,7 +1034,6 @@ END_EXTERN_C()
#define ZEND_CALL_FUNC_NAME "__call"
#define ZEND_CALLSTATIC_FUNC_NAME "__callstatic"
#define ZEND_TOSTRING_FUNC_NAME "__tostring"
-#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
#define ZEND_INVOKE_FUNC_NAME "__invoke"
#define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo"
@@ -1064,9 +1062,6 @@ END_EXTERN_C()
/* disable constant substitution at compile-time */
#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<6)
-/* disable usage of builtin instruction for strlen() */
-#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<7)
-
/* disable substitution of persistent constants at compile-time */
#define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<8)
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 49ee762c60..3148180a9a 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -33,6 +33,9 @@
#define MARK_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) |= IS_CONSTANT_VISITED_MARK
#define RESET_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) &= ~IS_CONSTANT_VISITED_MARK
+/* Use for special null/true/false constants. */
+static zval null_value, true_value, false_value;
+
void free_zend_constant(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
@@ -99,7 +102,6 @@ void clean_module_constants(int module_number)
int zend_startup_constants(void)
{
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
-
zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1);
return SUCCESS;
}
@@ -128,14 +130,17 @@ void zend_register_standard_constants(void)
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
- /* true/false constants */
- {
- REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST);
- REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT | CONST_CT_SUBST);
- REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS);
- }
- REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT | CONST_CT_SUBST);
+ REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS);
+
+ /* Special constants true/false/null. */
+ REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT);
+ REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT);
+ REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT);
+
+ ZVAL_NULL(&null_value);
+ ZVAL_TRUE(&true_value);
+ ZVAL_FALSE(&false_value);
}
@@ -188,7 +193,7 @@ ZEND_API void zend_register_double_constant(const char *name, size_t name_len, d
}
-ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number)
+ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number)
{
zend_constant c;
@@ -199,12 +204,12 @@ ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len,
}
-ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number)
+ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number)
{
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number);
}
-static zend_constant *zend_get_special_constant(const char *name, size_t name_len)
+static zend_constant *zend_get_halt_offset_constant(const char *name, size_t name_len)
{
zend_constant *c;
static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
@@ -230,6 +235,37 @@ static zend_constant *zend_get_special_constant(const char *name, size_t name_le
}
}
+ZEND_API zval *_zend_get_special_const(const char *name, size_t len) /* {{{ */
+{
+ if (len == 4) {
+ if ((name[0] == 'n' || name[0] == 'N') &&
+ (name[1] == 'u' || name[1] == 'U') &&
+ (name[2] == 'l' || name[2] == 'L') &&
+ (name[3] == 'l' || name[3] == 'L')
+ ) {
+ return &null_value;
+ }
+ if ((name[0] == 't' || name[0] == 'T') &&
+ (name[1] == 'r' || name[1] == 'R') &&
+ (name[2] == 'u' || name[2] == 'U') &&
+ (name[3] == 'e' || name[3] == 'E')
+ ) {
+ return &true_value;
+ }
+ } else {
+ if ((name[0] == 'f' || name[0] == 'F') &&
+ (name[1] == 'a' || name[1] == 'A') &&
+ (name[2] == 'l' || name[2] == 'L') &&
+ (name[3] == 's' || name[3] == 'S') &&
+ (name[4] == 'e' || name[4] == 'E')
+ ) {
+ return &false_value;
+ }
+ }
+ return 0;
+}
+/* }}} */
+
ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */
{
if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) {
@@ -243,80 +279,34 @@ ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *
}
/* }}} */
-static inline zend_constant *zend_get_constant_str_impl(const char *name, size_t name_len)
-{
- zend_constant *c;
- ALLOCA_FLAG(use_heap)
-
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) {
- char *lcname = do_alloca(name_len + 1, use_heap);
- zend_str_tolower_copy(lcname, name, name_len);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) {
- if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) {
- c = NULL;
- }
- } else {
- c = zend_get_special_constant(name, name_len);
- }
- free_alloca(lcname, use_heap);
- }
-
- return c;
-}
-
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len)
{
- zend_constant *c = zend_get_constant_str_impl(name, name_len);
- return c ? &c->value : NULL;
-}
+ zend_constant *c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len);
+ if (c) {
+ return &c->value;
+ }
-static inline zend_constant *zend_get_constant_impl(zend_string *name)
-{
- zval *zv;
- zend_constant *c;
- ALLOCA_FLAG(use_heap)
-
- zv = zend_hash_find(EG(zend_constants), name);
- if (zv == NULL) {
- char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap);
- zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name));
- zv = zend_hash_str_find(EG(zend_constants), lcname, ZSTR_LEN(name));
- if (zv != NULL) {
- c = Z_PTR_P(zv);
- if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) {
- c = NULL;
- }
- } else {
- c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name));
- }
- free_alloca(lcname, use_heap);
- return c;
- } else {
- return (zend_constant *) Z_PTR_P(zv);
+ c = zend_get_halt_offset_constant(name, name_len);
+ if (c) {
+ return &c->value;
}
+
+ return zend_get_special_const(name, name_len);
}
ZEND_API zval *zend_get_constant(zend_string *name)
{
- zend_constant *c = zend_get_constant_impl(name);
- return c ? &c->value : NULL;
-}
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c) {
+ return &c->value;
+ }
-static zend_bool is_access_deprecated(const zend_constant *c, const char *access_name) {
- const char *ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
- if (ns_sep) {
- /* Namespaces are always case-insensitive. Only compare shortname. */
- size_t shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
- size_t shortname_len = ZSTR_LEN(c->name) - shortname_offset;
- return memcmp(
- access_name + shortname_offset,
- ZSTR_VAL(c->name) + shortname_offset,
- shortname_len
- ) != 0;
- } else {
- /* No namespace, compare whole name */
- return memcmp(access_name, ZSTR_VAL(c->name), ZSTR_LEN(c->name)) != 0;
+ c = zend_get_halt_offset_constant(ZSTR_VAL(name), ZSTR_LEN(name));
+ if (c) {
+ return &c->value;
}
+
+ return zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name));
}
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags)
@@ -421,56 +411,34 @@ failure:
size_t lcname_len;
ALLOCA_FLAG(use_heap)
+ /* Lowercase the namespace portion */
lcname_len = prefix_len + 1 + const_name_len;
lcname = do_alloca(lcname_len + 1, use_heap);
zend_str_tolower_copy(lcname, name, prefix_len);
- /* Check for namespace constant */
lcname[prefix_len] = '\\';
memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) == NULL) {
- /* try lowercase */
- zend_str_tolower(lcname + prefix_len + 1, const_name_len);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) != NULL) {
- if ((ZEND_CONSTANT_FLAGS(c) & CONST_CS) != 0) {
- c = NULL;
- }
- }
- }
+ c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len);
free_alloca(lcname, use_heap);
- if (!c) {
- if (!(flags & IS_CONSTANT_UNQUALIFIED)) {
- return NULL;
- }
+ if (c) {
+ return &c->value;
+ }
- /* name requires runtime resolution, need to check non-namespaced name */
- c = zend_get_constant_str_impl(constant_name, const_name_len);
- name = constant_name;
+ if (!(flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE)) {
+ return NULL;
}
+
+ /* name requires runtime resolution, need to check non-namespaced name */
+ return zend_get_constant_str(constant_name, const_name_len);
} else {
if (cname) {
- c = zend_get_constant_impl(cname);
+ return zend_get_constant(cname);
} else {
- c = zend_get_constant_str_impl(name, name_len);
- }
- }
-
- if (!c) {
- return NULL;
- }
-
- if (!(flags & ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) {
- if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST)) && is_access_deprecated(c, name)) {
- zend_error(E_DEPRECATED,
- "Case-insensitive constants are deprecated. "
- "The correct casing for this constant is \"%s\"",
- ZSTR_VAL(c->name));
+ return zend_get_constant_str(name, name_len);
}
}
-
- return &c->value;
}
static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c)
@@ -491,38 +459,30 @@ ZEND_API int zend_register_constant(zend_constant *c)
zend_string *lowercase_name = NULL;
zend_string *name;
int ret = SUCCESS;
+ zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0;
#if 0
printf("Registering constant for module %d\n", c->module_number);
#endif
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CS)) {
- lowercase_name = zend_string_tolower_ex(c->name, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
+ char *slash = strrchr(ZSTR_VAL(c->name), '\\');
+ if (slash) {
+ lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), persistent);
+ zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name));
lowercase_name = zend_new_interned_string(lowercase_name);
name = lowercase_name;
} else {
- char *slash = strrchr(ZSTR_VAL(c->name), '\\');
- if (slash) {
- lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
- zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name));
- lowercase_name = zend_new_interned_string(lowercase_name);
- name = lowercase_name;
- } else {
- name = c->name;
- }
+ name = c->name;
}
- /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */
+ /* Check if the user is trying to define any special constant */
if (zend_string_equals_literal(name, "__COMPILER_HALT_OFFSET__")
- || zend_hash_add_constant(EG(zend_constants), name, c) == NULL) {
-
- /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
- if (ZSTR_VAL(c->name)[0] == '\0' && ZSTR_LEN(c->name) > sizeof("\0__COMPILER_HALT_OFFSET__")-1
- && memcmp(ZSTR_VAL(name), "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
- }
+ || (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)))
+ || zend_hash_add_constant(EG(zend_constants), name, c) == NULL
+ ) {
zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name));
zend_string_release(c->name);
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) {
+ if (!persistent) {
zval_ptr_dtor_nogc(&c->value);
}
ret = FAILURE;
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index ba0c798dc6..75be4c32b2 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -22,16 +22,12 @@
#include "zend_globals.h"
-#define CONST_CS (1<<0) /* Case Sensitive */
-#define CONST_PERSISTENT (1<<1) /* Persistent */
-#define CONST_CT_SUBST (1<<2) /* Allow compile-time substitution */
-#define CONST_NO_FILE_CACHE (1<<3) /* Can't be saved in file cache */
+#define CONST_CS 0 /* No longer used -- always case sensitive */
+#define CONST_PERSISTENT (1<<0) /* Persistent */
+#define CONST_NO_FILE_CACHE (1<<1) /* Can't be saved in file cache */
#define PHP_USER_CONSTANT 0x7fffff /* a constant defined in user space */
-/* Flag for zend_get_constant_ex(). Must not class with ZEND_FETCH_CLASS_* flags. */
-#define ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK 0x1000
-
typedef struct _zend_constant {
zval value;
zend_string *name;
@@ -83,12 +79,22 @@ ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zen
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number);
-ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number);
-ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number);
+ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number);
+ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number);
ZEND_API int zend_register_constant(zend_constant *c);
#ifdef ZTS
void zend_copy_constants(HashTable *target, HashTable *sourc);
#endif
+
+ZEND_API zval *_zend_get_special_const(const char *name, size_t name_len);
+
+static zend_always_inline zval *zend_get_special_const(const char *name, size_t name_len) {
+ if (name_len == 4 || name_len == 5) {
+ return _zend_get_special_const(name, name_len);
+ }
+ return NULL;
+}
+
END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant
diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h
index c0949e3638..0b6b54e51a 100644
--- a/Zend/zend_cpuinfo.h
+++ b/Zend/zend_cpuinfo.h
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Xinchen Hui <xinchen.h@zend.com> |
+ | Authors: Xinchen Hui <laruence@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
index 441458c033..dd7539523d 100644
--- a/Zend/zend_errors.h
+++ b/Zend/zend_errors.h
@@ -36,7 +36,15 @@
#define E_DEPRECATED (1<<13L)
#define E_USER_DEPRECATED (1<<14L)
+/* Indicates that this usually fatal error should not result in a bailout */
+#define E_DONT_BAIL (1<<15L)
+
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
+/* Fatal errors that are ignored by the silence operator */
+#define E_FATAL_ERRORS (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE)
+
+#define E_HAS_ONLY_FATAL_ERRORS(mask) !((mask) & ~E_FATAL_ERRORS)
+
#endif /* ZEND_ERRORS_H */
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index ecd946a06e..eb248b1ff2 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -27,6 +27,7 @@
#include "zend_vm.h"
#include "zend_dtrace.h"
#include "zend_smart_str.h"
+#include "zend_exceptions_arginfo.h"
ZEND_API zend_class_entry *zend_ce_throwable;
ZEND_API zend_class_entry *zend_ce_exception;
@@ -36,6 +37,7 @@ ZEND_API zend_class_entry *zend_ce_compile_error;
ZEND_API zend_class_entry *zend_ce_parse_error;
ZEND_API zend_class_entry *zend_ce_type_error;
ZEND_API zend_class_entry *zend_ce_argument_count_error;
+ZEND_API zend_class_entry *zend_ce_value_error;
ZEND_API zend_class_entry *zend_ce_arithmetic_error;
ZEND_API zend_class_entry *zend_ce_division_by_zero_error;
@@ -156,8 +158,9 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception) /* {{{ */
if (exception && (Z_OBJCE_P(exception) == zend_ce_parse_error || Z_OBJCE_P(exception) == zend_ce_compile_error)) {
return;
}
- if(EG(exception)) {
+ if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR);
+ zend_bailout();
}
zend_error_noreturn(E_CORE_ERROR, "Exception thrown without a stack frame");
}
@@ -629,7 +632,8 @@ ZEND_METHOD(exception, getTraceAsString)
trace = zend_read_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
if (Z_TYPE_P(trace) != IS_ARRAY) {
- RETURN_FALSE;
+ zend_type_error("trace is not an array");
+ return;
}
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
if (Z_TYPE_P(frame) != IS_ARRAY) {
@@ -757,14 +761,14 @@ ZEND_METHOD(exception, __toString)
/** {{{ Throwable method definition */
static const zend_function_entry zend_funcs_throwable[] = {
- ZEND_ABSTRACT_ME(throwable, getMessage, NULL)
- ZEND_ABSTRACT_ME(throwable, getCode, NULL)
- ZEND_ABSTRACT_ME(throwable, getFile, NULL)
- ZEND_ABSTRACT_ME(throwable, getLine, NULL)
- ZEND_ABSTRACT_ME(throwable, getTrace, NULL)
- ZEND_ABSTRACT_ME(throwable, getPrevious, NULL)
- ZEND_ABSTRACT_ME(throwable, getTraceAsString, NULL)
- ZEND_ABSTRACT_ME(throwable, __toString, NULL)
+ ZEND_ABSTRACT_ME(throwable, getMessage, arginfo_class_Throwable_getMessage)
+ ZEND_ABSTRACT_ME(throwable, getCode, arginfo_class_Throwable_getCode)
+ ZEND_ABSTRACT_ME(throwable, getFile, arginfo_class_Throwable_getFile)
+ ZEND_ABSTRACT_ME(throwable, getLine, arginfo_class_Throwable_getLine)
+ ZEND_ABSTRACT_ME(throwable, getTrace, arginfo_class_Throwable_getTrace)
+ ZEND_ABSTRACT_ME(throwable, getPrevious, arginfo_class_Throwable_getPrevious)
+ ZEND_ABSTRACT_ME(throwable, getTraceAsString, arginfo_class_Throwable_getTraceAsString)
+ ZEND_ABSTRACT_ME(throwable, __toString, arginfo_class_Throwable___toString)
ZEND_FE_END
};
/* }}} */
@@ -779,39 +783,24 @@ static const zend_function_entry zend_funcs_throwable[] = {
* And never try to change the state of exceptions and never implement anything
* that gives the user anything to accomplish this.
*/
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry default_exception_functions[] = {
- ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getLine, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTrace, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getPrevious, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, __toString, NULL, 0)
+ ZEND_ME(exception, __clone, arginfo_class_Exception___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __construct, arginfo_class_Exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, arginfo_class_Exception___wakeup, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, getMessage, arginfo_class_Exception_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getCode, arginfo_class_Exception_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getFile, arginfo_class_Exception_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getLine, arginfo_class_Exception_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTrace, arginfo_class_Exception_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getPrevious, arginfo_class_Exception_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTraceAsString, arginfo_class_Exception_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __toString, arginfo_class_Exception___toString, 0)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, severity)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, lineno)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry error_exception_functions[] = {
- ZEND_ME(error_exception, __construct, arginfo_error_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(error_exception, __construct, arginfo_class_ErrorException___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(error_exception, getSeverity, arginfo_class_ErrorException_getSeverity, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_FE_END
};
/* }}} */
@@ -872,6 +861,10 @@ void zend_register_default_exception(void) /* {{{ */
zend_ce_argument_count_error = zend_register_internal_class_ex(&ce, zend_ce_type_error);
zend_ce_argument_count_error->create_object = zend_default_exception_new;
+ INIT_CLASS_ENTRY(ce, "ValueError", NULL);
+ zend_ce_value_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_value_error->create_object = zend_default_exception_new;
+
INIT_CLASS_ENTRY(ce, "ArithmeticError", NULL);
zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, zend_ce_error);
zend_ce_arithmetic_error->create_object = zend_default_exception_new;
@@ -986,7 +979,8 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
zend_string *file = zval_get_string(GET_PROPERTY_SILENT(&exception, ZEND_STR_FILE));
zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, ZEND_STR_LINE));
- zend_error_helper(ce_exception == zend_ce_parse_error ? E_PARSE : E_COMPILE_ERROR,
+ zend_error_helper(
+ (ce_exception == zend_ce_parse_error ? E_PARSE : E_COMPILE_ERROR) | E_DONT_BAIL,
ZSTR_VAL(file), line, "%s", ZSTR_VAL(message));
zend_string_release_ex(file, 0);
@@ -996,7 +990,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
zend_string *str, *file = NULL;
zend_long line = 0;
- zend_call_method_with_0_params(&exception, ce_exception, &ex->ce->__tostring, "__tostring", &tmp);
+ zend_call_method_with_0_params(Z_OBJ(exception), ce_exception, &ex->ce->__tostring, "__tostring", &tmp);
if (!EG(exception)) {
if (Z_TYPE(tmp) != IS_STRING) {
zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name));
@@ -1029,7 +1023,8 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
file = zval_get_string(GET_PROPERTY_SILENT(&exception, ZEND_STR_FILE));
line = zval_get_long(GET_PROPERTY_SILENT(&exception, ZEND_STR_LINE));
- zend_error_va(severity, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line,
+ zend_error_va(severity | E_DONT_BAIL,
+ (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line,
"Uncaught %s\n thrown", ZSTR_VAL(str));
zend_string_release_ex(str, 0);
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index 5f31c4b25b..ec6f0a0201 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -32,6 +32,7 @@ extern ZEND_API zend_class_entry *zend_ce_compile_error;
extern ZEND_API zend_class_entry *zend_ce_parse_error;
extern ZEND_API zend_class_entry *zend_ce_type_error;
extern ZEND_API zend_class_entry *zend_ce_argument_count_error;
+extern ZEND_API zend_class_entry *zend_ce_value_error;
extern ZEND_API zend_class_entry *zend_ce_arithmetic_error;
extern ZEND_API zend_class_entry *zend_ce_division_by_zero_error;
diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php
new file mode 100644
index 0000000000..96d581caf9
--- /dev/null
+++ b/Zend/zend_exceptions.stub.php
@@ -0,0 +1,68 @@
+<?php
+
+interface Throwable
+{
+ /** @return string */
+ function getMessage();
+
+ /** @return int */
+ function getCode();
+
+ /** @return string */
+ function getFile();
+
+ /** @return int */
+ function getLine();
+
+ /** @return array */
+ function getTrace();
+
+ /** @return ?Throwable */
+ function getPrevious();
+
+ /** @return string */
+ function getTraceAsString();
+
+ /** @return string */
+ function __toString();
+}
+
+class Exception implements Throwable
+{
+ final private function __clone() {}
+
+ function __construct(string $message = UNKNOWN, int $code = 0, ?Throwable $previous = null) {}
+
+ function __wakeup() {}
+
+ /** @return string */
+ final function getMessage() {}
+
+ /** @return int */
+ final function getCode() {}
+
+ /** @return string */
+ final function getFile() {}
+
+ /** @return int */
+ final function getLine() {}
+
+ /** @return array */
+ final function getTrace() {}
+
+ /** @return ?Throwable */
+ final function getPrevious() {}
+
+ /** @return string */
+ final function getTraceAsString() {}
+
+ /** @return string */
+ function __toString() {}
+}
+
+class ErrorException extends Exception
+{
+ function __construct(string $message = UNKNOWN, int $code = 0, int $severity = E_ERROR, string $filename = UNKNOWN, int $lineno = 0, ?Throwable $previous = null) {}
+
+ final function getSeverity() {}
+}
diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h
new file mode 100644
index 0000000000..c2f83e47e5
--- /dev/null
+++ b/Zend/zend_exceptions_arginfo.h
@@ -0,0 +1,55 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Throwable_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable___toString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___clone arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Exception___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Exception___wakeup arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___toString arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ErrorException___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, severity, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, lineno, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ErrorException_getSeverity arginfo_class_Throwable_getMessage
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 04aa3fee6e..6875ac5e8a 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -109,16 +109,16 @@
typedef int (ZEND_FASTCALL *incdec_t)(zval *);
-#define get_zval_ptr(op_type, node, should_free, type) _get_zval_ptr(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_deref(op_type, node, should_free, type) _get_zval_ptr_deref(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_undef(op_type, node, should_free, type) _get_zval_ptr_undef(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_op_data_zval_ptr_r(op_type, node, should_free) _get_op_data_zval_ptr_r(op_type, node, should_free EXECUTE_DATA_CC OPLINE_CC)
-#define get_op_data_zval_ptr_deref_r(op_type, node, should_free) _get_op_data_zval_ptr_deref_r(op_type, node, should_free EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_ptr(op_type, node, should_free, type) _get_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
-#define get_zval_ptr_ptr_undef(op_type, node, should_free, type) _get_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
-#define get_obj_zval_ptr(op_type, node, should_free, type) _get_obj_zval_ptr(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_obj_zval_ptr_undef(op_type, node, should_free, type) _get_obj_zval_ptr_undef(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_obj_zval_ptr_ptr(op_type, node, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
+#define get_zval_ptr(op_type, node, type) _get_zval_ptr(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_deref(op_type, node, type) _get_zval_ptr_deref(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_undef(op_type, node, type) _get_zval_ptr_undef(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_op_data_zval_ptr_r(op_type, node) _get_op_data_zval_ptr_r(op_type, node EXECUTE_DATA_CC OPLINE_CC)
+#define get_op_data_zval_ptr_deref_r(op_type, node) _get_op_data_zval_ptr_deref_r(op_type, node EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_ptr(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
+#define get_zval_ptr_ptr_undef(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
+#define get_obj_zval_ptr(op_type, node, type) _get_obj_zval_ptr(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_obj_zval_ptr_undef(op_type, node, type) _get_obj_zval_ptr_undef(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_obj_zval_ptr_ptr(op_type, node, type) _get_obj_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
#define RETURN_VALUE_USED(opline) ((opline)->result_type != IS_UNUSED)
@@ -141,13 +141,12 @@ ZEND_API const zend_internal_function zend_pass_function = {
{NULL,NULL,NULL,NULL} /* reserved */
};
-#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op, result) do { \
- zval *__container_to_free = (free_op); \
- if (UNEXPECTED(__container_to_free) \
- && EXPECTED(Z_REFCOUNTED_P(__container_to_free))) { \
+#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_var) do { \
+ zval *__container_to_free = EX_VAR(free_var); \
+ if (UNEXPECTED(Z_REFCOUNTED_P(__container_to_free))) { \
zend_refcounted *__ref = Z_COUNTED_P(__container_to_free); \
if (UNEXPECTED(!GC_DELREF(__ref))) { \
- zval *__zv = (result); \
+ zval *__zv = EX_VAR(opline->result.var); \
if (EXPECTED(Z_TYPE_P(__zv) == IS_INDIRECT)) { \
ZVAL_COPY(__zv, Z_INDIRECT_P(__zv)); \
} \
@@ -156,20 +155,16 @@ ZEND_API const zend_internal_function zend_pass_function = {
} \
} while (0)
-#define FREE_OP(should_free) \
- if (should_free) { \
- zval_ptr_dtor_nogc(should_free); \
- }
-
-#define FREE_UNFETCHED_OP(type, var) \
+#define FREE_OP(type, var) \
if ((type) & (IS_TMP_VAR|IS_VAR)) { \
zval_ptr_dtor_nogc(EX_VAR(var)); \
}
-#define FREE_OP_VAR_PTR(should_free) \
- if (should_free) { \
- zval_ptr_dtor_nogc(should_free); \
- }
+#define FREE_UNFETCHED_OP(type, var) \
+ FREE_OP(type, var)
+
+#define FREE_OP_VAR_PTR(type, var) \
+ FREE_OP(type, var)
#define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
@@ -241,29 +236,26 @@ ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute
return EX_VAR(var);
}
-static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
ZEND_ASSERT(Z_TYPE_P(ret) != IS_REFERENCE);
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_var(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
ZVAL_DEREF(ret);
return ret;
}
@@ -272,7 +264,7 @@ static zend_never_inline ZEND_COLD zval* zval_undefined_cv(uint32_t var EXECUTE_
{
if (EXPECTED(EG(exception) == NULL)) {
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
- zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(cv));
}
return &EG(uninitialized_zval);
}
@@ -390,17 +382,16 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D
return ret;
}
-static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -411,17 +402,16 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_f
}
}
-static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node, zend_free_op *should_free EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline + 1, node);
} else if (op_type == IS_CV) {
@@ -432,17 +422,16 @@ static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op no
}
}
-static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_var_deref(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var_deref(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -453,17 +442,16 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op
}
}
-static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(int op_type, znode_op node, zend_free_op *should_free EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_var_deref(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var_deref(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline + 1, node);
} else if (op_type == IS_CV) {
@@ -474,17 +462,16 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_dere
}
}
-static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -495,55 +482,48 @@ static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node,
}
}
-static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
- *should_free = NULL;
ret = Z_INDIRECT_P(ret);
- } else {
- *should_free = ret;
}
return ret;
}
-static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC)
+static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC)
{
if (op_type == IS_CV) {
- *should_free = NULL;
return _get_zval_ptr_cv(node.var, type EXECUTE_DATA_CC);
} else /* if (op_type == IS_VAR) */ {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_ptr_var(node.var EXECUTE_DATA_CC);
}
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr(op_type, op, should_free, type);
+ return get_zval_ptr(op_type, op, type);
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr_undef(op_type, op, should_free, type);
+ return get_zval_ptr_undef(op_type, op, type);
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr_ptr(op_type, node, should_free, type);
+ return get_zval_ptr_ptr(op_type, node, type);
}
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
@@ -602,39 +582,26 @@ static zend_never_inline ZEND_COLD int zend_wrong_assign_to_variable_reference(z
return 1;
}
-static void zend_format_type(zend_type type, const char **part1, const char **part2) {
- *part1 = ZEND_TYPE_ALLOW_NULL(type) ? "?" : "";
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (ZEND_TYPE_IS_CE(type)) {
- *part2 = ZSTR_VAL(ZEND_TYPE_CE(type)->name);
- } else {
- *part2 = ZSTR_VAL(ZEND_TYPE_NAME(type));
- }
- } else {
- *part2 = zend_get_type_by_const(ZEND_TYPE_CODE(type));
- }
-}
-
static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(zend_property_info *prop, const char *type) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
zend_type_error(
- "Cannot auto-initialize an %s inside property %s::$%s of type %s%s",
+ "Cannot auto-initialize an %s inside property %s::$%s of type %s",
type,
ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_ref_error(zend_property_info *prop, const char *type) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
zend_type_error(
- "Cannot auto-initialize an %s inside a reference held by property %s::$%s of type %s%s",
+ "Cannot auto-initialize an %s inside a reference held by property %s::$%s of type %s",
type,
ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_error(
@@ -645,75 +612,41 @@ static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_err
zend_get_unmangled_property_name(prop->name));
}
-static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref);
static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
/* this should modify object only if it's empty */
-static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
-{
- zend_object *obj;
- zval *ref = NULL;
- if (Z_ISREF_P(object)) {
- ref = object;
- object = Z_REFVAL_P(object);
- }
-
- if (UNEXPECTED(Z_TYPE_P(object) > IS_FALSE &&
- (Z_TYPE_P(object) != IS_STRING || Z_STRLEN_P(object) != 0))) {
- if (opline->op1_type != IS_VAR || EXPECTED(!Z_ISERROR_P(object))) {
- zend_string *tmp_property_name;
- zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
-
- if (opline->opcode == ZEND_PRE_INC_OBJ
- || opline->opcode == ZEND_PRE_DEC_OBJ
- || opline->opcode == ZEND_POST_INC_OBJ
- || opline->opcode == ZEND_POST_DEC_OBJ) {
- zend_error(E_WARNING, "Attempt to increment/decrement property '%s' of non-object", ZSTR_VAL(property_name));
- } else if (opline->opcode == ZEND_FETCH_OBJ_W
- || opline->opcode == ZEND_FETCH_OBJ_RW
- || opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
- || opline->opcode == ZEND_ASSIGN_OBJ_REF) {
- zend_error(E_WARNING, "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
- } else {
- zend_error(E_WARNING, "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
- }
- zend_tmp_string_release(tmp_property_name);
- }
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- return NULL;
- }
+static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_throw_non_object_error(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
+{
+ zend_string *tmp_property_name;
+ zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
- if (ref && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(ref))) {
- if (UNEXPECTED(!zend_verify_ref_stdClass_assignable(Z_REF_P(ref)))) {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- }
- return NULL;
- }
+ if (opline->opcode == ZEND_PRE_INC_OBJ
+ || opline->opcode == ZEND_PRE_DEC_OBJ
+ || opline->opcode == ZEND_POST_INC_OBJ
+ || opline->opcode == ZEND_POST_DEC_OBJ) {
+ zend_throw_error(NULL,
+ "Attempt to increment/decrement property '%s' of non-object",
+ ZSTR_VAL(property_name));
+ } else if (opline->opcode == ZEND_FETCH_OBJ_W
+ || opline->opcode == ZEND_FETCH_OBJ_RW
+ || opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
+ || opline->opcode == ZEND_ASSIGN_OBJ_REF) {
+ zend_throw_error(NULL,
+ "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
+ } else {
+ zend_throw_error(NULL,
+ "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
}
+ zend_tmp_string_release(tmp_property_name);
- zval_ptr_dtor_nogc(object);
- object_init(object);
- Z_ADDREF_P(object);
- obj = Z_OBJ_P(object);
- zend_error(E_WARNING, "Creating default object from empty value");
- if (GC_REFCOUNT(obj) == 1) {
- /* the enclosing container was deleted, obj is unreferenced */
- OBJ_RELEASE(obj);
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- return NULL;
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
- Z_DELREF_P(object);
- return object;
}
static ZEND_COLD void zend_verify_type_error_common(
const zend_function *zf, const zend_arg_info *arg_info,
- const zend_class_entry *ce, zval *value,
+ void **cache_slot, zval *value,
const char **fname, const char **fsep, const char **fclass,
const char **need_msg, const char **need_kind, const char **need_or_null,
const char **given_msg, const char **given_kind)
@@ -729,6 +662,7 @@ static ZEND_COLD void zend_verify_type_error_common(
}
if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
+ zend_class_entry *ce = *cache_slot;
if (ce) {
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
*need_msg = "implement interface ";
@@ -744,22 +678,25 @@ static ZEND_COLD void zend_verify_type_error_common(
*need_kind = ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type));
}
} else {
- switch (ZEND_TYPE_CODE(arg_info->type)) {
- case IS_OBJECT:
+ zend_type type = ZEND_TYPE_WITHOUT_NULL(arg_info->type);
+ switch (ZEND_TYPE_MASK(type)) {
+ case MAY_BE_OBJECT:
*need_msg = "be an ";
*need_kind = "object";
break;
- case IS_CALLABLE:
+ case MAY_BE_CALLABLE:
*need_msg = "be callable";
*need_kind = "";
break;
- case IS_ITERABLE:
+ case MAY_BE_ITERABLE:
*need_msg = "be iterable";
*need_kind = "";
break;
default:
+ /* TODO: The zend_type_to_string() result is guaranteed interned here.
+ * It would be beter to switch all this code to use zend_string though. */
*need_msg = "be of the type ";
- *need_kind = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type));
+ *need_kind = ZSTR_VAL(zend_type_to_string(type));
break;
}
}
@@ -784,9 +721,9 @@ static ZEND_COLD void zend_verify_type_error_common(
}
}
-static ZEND_COLD void zend_verify_arg_error(
+ZEND_API ZEND_COLD void zend_verify_arg_error(
const zend_function *zf, const zend_arg_info *arg_info,
- int arg_num, const zend_class_entry *ce, zval *value)
+ int arg_num, void **cache_slot, zval *value)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
const char *fname, *fsep, *fclass;
@@ -800,7 +737,7 @@ static ZEND_COLD void zend_verify_arg_error(
if (value) {
zend_verify_type_error_common(
- zf, arg_info, ce, value,
+ zf, arg_info, cache_slot, value,
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
if (zf->common.type == ZEND_USER_FUNCTION) {
@@ -819,108 +756,129 @@ static ZEND_COLD void zend_verify_arg_error(
}
}
-static int is_null_constant(zend_class_entry *scope, zval *default_value)
+static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
{
- if (Z_TYPE_P(default_value) == IS_CONSTANT_AST) {
- zval constant;
+ if (type_mask & (MAY_BE_TRUE|MAY_BE_FALSE)) {
+ zend_bool dest;
- ZVAL_COPY(&constant, default_value);
- if (UNEXPECTED(zval_update_constant_ex(&constant, scope) != SUCCESS)) {
+ if (!zend_parse_arg_bool_weak(arg, &dest)) {
return 0;
}
- if (Z_TYPE(constant) == IS_NULL) {
- return 1;
- }
- zval_ptr_dtor_nogc(&constant);
+ zval_ptr_dtor(arg);
+ ZVAL_BOOL(arg, dest);
+ return 1;
}
- return 0;
-}
+ if (type_mask & MAY_BE_LONG) {
+ zend_long dest;
-static zend_bool zend_verify_weak_scalar_type_hint(zend_uchar type_hint, zval *arg)
-{
- switch (type_hint) {
- case _IS_BOOL: {
- zend_bool dest;
+ if (!zend_parse_arg_long_weak(arg, &dest)) {
+ return 0;
+ }
+ zval_ptr_dtor(arg);
+ ZVAL_LONG(arg, dest);
+ return 1;
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ double dest;
- if (!zend_parse_arg_bool_weak(arg, &dest)) {
- return 0;
- }
- zval_ptr_dtor(arg);
- ZVAL_BOOL(arg, dest);
- return 1;
+ if (!zend_parse_arg_double_weak(arg, &dest)) {
+ return 0;
}
- case IS_LONG: {
- zend_long dest;
+ zval_ptr_dtor(arg);
+ ZVAL_DOUBLE(arg, dest);
+ return 1;
+ }
+ if (type_mask & MAY_BE_STRING) {
+ zend_string *dest;
- if (!zend_parse_arg_long_weak(arg, &dest)) {
- return 0;
+ /* on success "arg" is converted to IS_STRING */
+ return zend_parse_arg_str_weak(arg, &dest);
+ }
+ return 0;
+}
+
+#if ZEND_DEBUG
+/* Used to sanity-check internal arginfo types without performing any actual type conversions. */
+static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_mask, zval *arg)
+{
+ if (type_mask & (MAY_BE_TRUE|MAY_BE_FALSE)) {
+ zend_bool dest;
+ return zend_parse_arg_bool_weak(arg, &dest);
+ }
+ if (type_mask & MAY_BE_LONG) {
+ zend_long dest;
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ /* Handle this case separately to avoid the "non well-formed" warning */
+ double dval;
+ zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, &dval, 1);
+ if (type == IS_LONG) {
+ return 1;
}
- zval_ptr_dtor(arg);
- ZVAL_LONG(arg, dest);
- return 1;
- }
- case IS_DOUBLE: {
- double dest;
+ if (type == IS_DOUBLE) {
+ return !zend_isnan(dval) && ZEND_DOUBLE_FITS_LONG(dval);
- if (!zend_parse_arg_double_weak(arg, &dest)) {
- return 0;
}
- zval_ptr_dtor(arg);
- ZVAL_DOUBLE(arg, dest);
- return 1;
+ return 0;
}
- case IS_STRING: {
- zend_string *dest;
-
- /* on success "arg" is converted to IS_STRING */
- return zend_parse_arg_str_weak(arg, &dest);
+ return zend_parse_arg_long_weak(arg, &dest);
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ double dest;
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ /* Handle this case separately to avoid the "non well-formed" warning */
+ return is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 1) != 0;
}
- default:
- return 0;
+ return zend_parse_arg_double_weak(arg, &dest);
}
+ if (type_mask & MAY_BE_STRING) {
+ /* We don't call cast_object here, because this check must be side-effect free. As this
+ * is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
+ * more than actually allowed here. */
+ return Z_TYPE_P(arg) < IS_STRING || Z_TYPE_P(arg) == IS_OBJECT;
+ }
+ return 0;
}
+#endif
-static zend_bool zend_verify_scalar_type_hint(zend_uchar type_hint, zval *arg, zend_bool strict)
+ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg)
{
if (UNEXPECTED(strict)) {
/* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */
- if (type_hint != IS_DOUBLE || Z_TYPE_P(arg) != IS_LONG) {
+ if (!(type_mask & MAY_BE_DOUBLE) || Z_TYPE_P(arg) != IS_LONG) {
return 0;
}
} else if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
/* NULL may be accepted only by nullable hints (this is already checked) */
+ if (is_internal_arg && (type_mask & (MAY_BE_TRUE|MAY_BE_FALSE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING))) {
+ /* As an exception, null is allowed for scalar types in weak mode. */
+ return 1;
+ }
return 0;
}
- return zend_verify_weak_scalar_type_hint(type_hint, arg);
+#if ZEND_DEBUG
+ if (is_internal_arg) {
+ return zend_verify_weak_scalar_type_hint_no_sideeffect(type_mask, arg);
+ }
+#endif
+ return zend_verify_weak_scalar_type_hint(type_mask, arg);
}
ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_info *info, zval *property)
{
- const char *prop_type1, *prop_type2;
+ zend_string *type_str;
/* we _may_ land here in case reading already errored and runtime cache thus has not been updated (i.e. it contains a valid but unrelated info) */
if (EG(exception)) {
return;
}
- // TODO Switch to a more standard error message?
- zend_format_type(info->type, &prop_type1, &prop_type2);
- (void) prop_type1;
- if (ZEND_TYPE_IS_CLASS(info->type)) {
- zend_type_error("Typed property %s::$%s must be an instance of %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- prop_type2,
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- } else {
- zend_type_error("Typed property %s::$%s must be %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- prop_type2,
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- }
+ type_str = zend_type_to_string(info->type);
+ zend_type_error("Cannot assign %s to property %s::$%s of type %s",
+ Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)),
+ ZSTR_VAL(info->ce->name),
+ zend_get_unmangled_property_name(info->name),
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
static zend_bool zend_resolve_class_type(zend_type *type, zend_class_entry *self_ce) {
@@ -968,17 +926,13 @@ static zend_always_inline zend_bool i_zend_check_property_type(zend_property_inf
return instanceof_function(Z_OBJCE_P(property), ZEND_TYPE_CE(info->type));
}
- ZEND_ASSERT(ZEND_TYPE_CODE(info->type) != IS_CALLABLE);
- if (EXPECTED(ZEND_TYPE_CODE(info->type) == Z_TYPE_P(property))) {
+ ZEND_ASSERT(!(ZEND_TYPE_MASK(info->type) & MAY_BE_CALLABLE));
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(info->type, Z_TYPE_P(property)))) {
return 1;
- } else if (EXPECTED(Z_TYPE_P(property) == IS_NULL)) {
- return ZEND_TYPE_ALLOW_NULL(info->type);
- } else if (ZEND_TYPE_CODE(info->type) == _IS_BOOL && EXPECTED(Z_TYPE_P(property) == IS_FALSE || Z_TYPE_P(property) == IS_TRUE)) {
- return 1;
- } else if (ZEND_TYPE_CODE(info->type) == IS_ITERABLE) {
+ } else if (ZEND_TYPE_MASK(info->type) & MAY_BE_ITERABLE) {
return zend_is_iterable(property);
} else {
- return zend_verify_scalar_type_hint(ZEND_TYPE_CODE(info->type), property, strict);
+ return zend_verify_scalar_type_hint(ZEND_TYPE_MASK(info->type), property, strict, 0);
}
}
@@ -1013,12 +967,11 @@ static zend_never_inline zval* zend_assign_to_typed_prop(zend_property_info *inf
static zend_always_inline zend_bool zend_check_type(
- zend_type type,
- zval *arg, zend_class_entry **ce, void **cache_slot,
- zval *default_value, zend_class_entry *scope,
- zend_bool is_return_type)
+ zend_type type, zval *arg, void **cache_slot, zend_class_entry *scope,
+ zend_bool is_return_type, zend_bool is_internal)
{
zend_reference *ref = NULL;
+ uint32_t type_mask;
if (!ZEND_TYPE_IS_SET(type)) {
return 1;
@@ -1030,121 +983,130 @@ static zend_always_inline zend_bool zend_check_type(
}
if (ZEND_TYPE_IS_CLASS(type)) {
+ zend_class_entry *ce;
if (EXPECTED(*cache_slot)) {
- *ce = (zend_class_entry *) *cache_slot;
+ ce = (zend_class_entry *) *cache_slot;
} else {
- *ce = zend_fetch_class(ZEND_TYPE_NAME(type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
- if (UNEXPECTED(!*ce)) {
- return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
+ ce = zend_fetch_class(ZEND_TYPE_NAME(type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (UNEXPECTED(!ce)) {
+ return Z_TYPE_P(arg) == IS_NULL && ZEND_TYPE_ALLOW_NULL(type);
}
- *cache_slot = (void *) *ce;
+ *cache_slot = (void *) ce;
}
if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
- return instanceof_function(Z_OBJCE_P(arg), *ce);
+ return instanceof_function(Z_OBJCE_P(arg), ce);
}
- return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
- } else if (EXPECTED(ZEND_TYPE_CODE(type) == Z_TYPE_P(arg))) {
- return 1;
- }
-
- if (Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)))) {
- /* Null passed to nullable type */
+ return Z_TYPE_P(arg) == IS_NULL && ZEND_TYPE_ALLOW_NULL(type);
+ } else if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE_P(arg)))) {
return 1;
}
- if (ZEND_TYPE_CODE(type) == IS_CALLABLE) {
+ type_mask = ZEND_TYPE_MASK(type);
+ if (type_mask & MAY_BE_CALLABLE) {
return zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL);
- } else if (ZEND_TYPE_CODE(type) == IS_ITERABLE) {
+ } else if (type_mask & MAY_BE_ITERABLE) {
return zend_is_iterable(arg);
- } else if (ZEND_TYPE_CODE(type) == _IS_BOOL &&
- EXPECTED(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE)) {
- return 1;
} else if (ref && ZEND_REF_HAS_TYPE_SOURCES(ref)) {
return 0; /* we cannot have conversions for typed refs */
+ } else if (is_internal && is_return_type) {
+ /* For internal returns, the type has to match exactly, because we're not
+ * going to check it for non-debug builds, and there will be no chance to
+ * apply coercions. */
+ return 0;
} else {
- return zend_verify_scalar_type_hint(ZEND_TYPE_CODE(type), arg,
- is_return_type ? ZEND_RET_USES_STRICT_TYPES() : ZEND_ARG_USES_STRICT_TYPES());
+ return zend_verify_scalar_type_hint(type_mask, arg,
+ is_return_type ? ZEND_RET_USES_STRICT_TYPES() : ZEND_ARG_USES_STRICT_TYPES(),
+ is_internal);
}
/* Special handling for IS_VOID is not necessary (for return types),
* because this case is already checked at compile-time. */
}
-static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
-{
- zend_arg_info *cur_arg_info;
- zend_class_entry *ce;
-
- if (EXPECTED(arg_num <= zf->common.num_args)) {
- cur_arg_info = &zf->common.arg_info[arg_num-1];
- } else if (UNEXPECTED(zf->common.fn_flags & ZEND_ACC_VARIADIC)) {
- cur_arg_info = &zf->common.arg_info[zf->common.num_args];
- } else {
- return 1;
- }
-
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
- return 0;
- }
-
- return 1;
-}
-
-static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
+static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot)
{
zend_arg_info *cur_arg_info = &zf->common.arg_info[arg_num-1];
- zend_class_entry *ce;
ZEND_ASSERT(arg_num <= zf->common.num_args);
cur_arg_info = &zf->common.arg_info[arg_num-1];
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
+ if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
+ zend_verify_arg_error(zf, cur_arg_info, arg_num, cache_slot, arg);
return 0;
}
return 1;
}
-static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
+static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot)
{
zend_arg_info *cur_arg_info;
- zend_class_entry *ce;
ZEND_ASSERT(arg_num > zf->common.num_args);
ZEND_ASSERT(zf->common.fn_flags & ZEND_ACC_VARIADIC);
cur_arg_info = &zf->common.arg_info[zf->common.num_args];
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
+ if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
+ zend_verify_arg_error(zf, cur_arg_info, arg_num, cache_slot, arg);
return 0;
}
return 1;
}
-static zend_never_inline int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call)
+static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call)
{
uint32_t i;
uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
- zval *p = ZEND_CALL_ARG(call, 1);
- void *dummy_cache_slot;
+ zval *arg = ZEND_CALL_ARG(call, 1);
for (i = 0; i < num_args; ++i) {
- dummy_cache_slot = NULL;
- if (UNEXPECTED(!zend_verify_arg_type(fbc, i + 1, p, NULL, &dummy_cache_slot))) {
- EG(current_execute_data) = call->prev_execute_data;
+ zend_arg_info *cur_arg_info;
+ void *dummy_cache_slot = NULL;
+
+ if (EXPECTED(i < fbc->common.num_args)) {
+ cur_arg_info = &fbc->common.arg_info[i];
+ } else if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
+ cur_arg_info = &fbc->common.arg_info[fbc->common.num_args];
+ } else {
+ break;
+ }
+
+ if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &dummy_cache_slot, fbc->common.scope, 0, /* is_internal */ 1))) {
return 0;
}
- p++;
+ arg++;
}
return 1;
}
+#if ZEND_DEBUG
+/* Determine whether an internal call should throw, because the passed arguments violate
+ * an arginfo constraint. This is only checked in debug builds. In release builds, we
+ * trust that arginfo matches what is enforced by zend_parse_parameters. */
+static zend_always_inline zend_bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call)
+{
+ if (fbc->common.required_num_args > ZEND_CALL_NUM_ARGS(call)) {
+ return 1;
+ }
+
+ if ((fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) &&
+ !zend_verify_internal_arg_types(fbc, call)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc)
+{
+ zend_error(E_CORE_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
+ fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
+ fbc->common.scope ? "::" : "",
+ ZSTR_VAL(fbc->common.function_name));
+}
+#endif
+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data)
{
zend_execute_data *ptr = EX(prev_execute_data);
@@ -1171,14 +1133,14 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *
}
static ZEND_COLD void zend_verify_return_error(
- const zend_function *zf, const zend_class_entry *ce, zval *value)
+ const zend_function *zf, void **cache_slot, zval *value)
{
const zend_arg_info *arg_info = &zf->common.arg_info[-1];
const char *fname, *fsep, *fclass;
const char *need_msg, *need_kind, *need_or_null, *given_msg, *given_kind;
zend_verify_type_error_common(
- zf, arg_info, ce, value,
+ zf, arg_info, cache_slot, value,
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
zend_type_error("Return value of %s%s%s() must %s%s%s, %s%s returned",
@@ -1187,14 +1149,14 @@ static ZEND_COLD void zend_verify_return_error(
#if ZEND_DEBUG
static ZEND_COLD void zend_verify_internal_return_error(
- const zend_function *zf, const zend_class_entry *ce, zval *value)
+ const zend_function *zf, void **cache_slot, zval *value)
{
const zend_arg_info *arg_info = &zf->common.arg_info[-1];
const char *fname, *fsep, *fclass;
const char *need_msg, *need_kind, *need_or_null, *given_msg, *given_kind;
zend_verify_type_error_common(
- zf, arg_info, ce, value,
+ zf, arg_info, cache_slot, value,
&fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
zend_error_noreturn(E_CORE_ERROR, "Return value of %s%s%s() must %s%s%s, %s%s returned",
@@ -1222,10 +1184,9 @@ static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, con
static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
{
zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1;
- zend_class_entry *ce = NULL;
void *dummy_cache_slot = NULL;
- if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
+ if (ZEND_TYPE_IS_MASK(ret_info->type) && (ZEND_TYPE_MASK(ret_info->type) & MAY_BE_VOID)) {
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
return 0;
@@ -1233,8 +1194,8 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
return 1;
}
- if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
- zend_verify_internal_return_error(zf, ce, ret);
+ if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &dummy_cache_slot, NULL, 1, /* is_internal */ 1))) {
+ zend_verify_internal_return_error(zf, &dummy_cache_slot, ret);
return 0;
}
@@ -1245,10 +1206,9 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
static zend_always_inline void zend_verify_return_type(zend_function *zf, zval *ret, void **cache_slot)
{
zend_arg_info *ret_info = zf->common.arg_info - 1;
- zend_class_entry *ce = NULL;
- if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, cache_slot, NULL, NULL, 1))) {
- zend_verify_return_error(zf, ce, ret);
+ if (UNEXPECTED(!zend_check_type(ret_info->type, ret, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(zf, cache_slot, ret);
}
}
@@ -1256,19 +1216,19 @@ static ZEND_COLD int zend_verify_missing_return_type(const zend_function *zf, vo
{
zend_arg_info *ret_info = zf->common.arg_info - 1;
- if (ZEND_TYPE_IS_SET(ret_info->type) && UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) != IS_VOID)) {
- zend_class_entry *ce = NULL;
+ if (ZEND_TYPE_IS_SET(ret_info->type)
+ && (!ZEND_TYPE_IS_MASK(ret_info->type)
+ || !(ZEND_TYPE_MASK(ret_info->type) & MAY_BE_VOID))) {
+ // TODO: Eliminate this!
if (ZEND_TYPE_IS_CLASS(ret_info->type)) {
- if (EXPECTED(*cache_slot)) {
- ce = (zend_class_entry*) *cache_slot;
- } else {
- ce = zend_fetch_class(ZEND_TYPE_NAME(ret_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (UNEXPECTED(!*cache_slot)) {
+ zend_class_entry *ce = zend_fetch_class(ZEND_TYPE_NAME(ret_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
if (ce) {
- *cache_slot = (void*)ce;
+ *cache_slot = (void *) ce;
}
}
}
- zend_verify_return_error(zf, ce, NULL);
+ zend_verify_return_error(zf, cache_slot, NULL);
return 0;
}
return 1;
@@ -1281,12 +1241,12 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(v
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset(void)
{
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
}
static zend_never_inline void zend_assign_to_object_dim(zval *object, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
- Z_OBJ_HT_P(object)->write_dimension(object, dim, value);
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), dim, value);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -1317,25 +1277,15 @@ static zend_always_inline int zend_binary_op(zval *ret, zval *op1, zval *op2 OPL
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
{
- zend_free_op free_op_data1;
zval *value;
zval *z;
zval rv, res;
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
- if ((z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
-
- if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
+ if ((z = Z_OBJ_HT_P(object)->read_dimension(Z_OBJ_P(object), property, BP_VAR_R, &rv)) != NULL) {
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
if (zend_binary_op(&res, z, value OPLINE_CC) == SUCCESS) {
- Z_OBJ_HT_P(object)->write_dimension(object, property, &res);
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), property, &res);
}
if (z == &rv) {
zval_ptr_dtor(&rv);
@@ -1350,7 +1300,7 @@ static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *
ZVAL_NULL(EX_VAR(opline->result.var));
}
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
}
static zend_never_inline void zend_binary_assign_op_typed_ref(zend_reference *ref, zval *value OPLINE_DC EXECUTE_DATA_DC)
@@ -1400,7 +1350,7 @@ try_again:
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
- zend_error(E_NOTICE, "String offset cast occurred");
+ zend_error(E_WARNING, "String offset cast occurred");
break;
case IS_REFERENCE:
dim = Z_REFVAL_P(dim);
@@ -1530,7 +1480,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_read(z
{
zend_string *tmp_property_name;
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
- zend_error(E_NOTICE, "Trying to get property '%s' of non-object", ZSTR_VAL(property_name));
+ zend_error(E_WARNING, "Trying to get property '%s' of non-object", ZSTR_VAL(property_name));
zend_tmp_string_release(tmp_property_name);
}
@@ -1542,12 +1492,6 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(c
ZSTR_VAL(fbc->common.function_name));
}
-static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_abstract_method(const zend_function *fbc)
-{
- zend_throw_error(NULL, "Cannot call abstract method %s::%s()",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
-}
-
static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
zend_uchar c;
@@ -1622,7 +1566,7 @@ static zend_property_info *zend_get_prop_not_accepting_double(zend_reference *re
{
zend_property_info *prop;
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
- if (ZEND_TYPE_CODE(prop->type) != IS_DOUBLE) {
+ if (!ZEND_TYPE_IS_MASK(prop->type) || !(ZEND_TYPE_MASK(prop->type) & MAY_BE_DOUBLE)) {
return prop;
}
} ZEND_REF_FOREACH_TYPE_SOURCES_END();
@@ -1653,19 +1597,20 @@ static ZEND_COLD zend_long zend_throw_incdec_ref_error(zend_reference *ref OPLIN
}
static ZEND_COLD zend_long zend_throw_incdec_prop_error(zend_property_info *prop OPLINE_DC) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
if (ZEND_IS_INCREMENT(opline->opcode)) {
- zend_type_error("Cannot increment property %s::$%s of type %s%s past its maximal value",
+ zend_type_error("Cannot increment property %s::$%s of type %s past its maximal value",
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2);
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MAX;
} else {
- zend_type_error("Cannot decrement property %s::$%s of type %s%s past its minimal value",
+ zend_type_error("Cannot decrement property %s::$%s of type %s past its minimal value",
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2);
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MIN;
}
}
@@ -1800,30 +1745,20 @@ static void zend_post_incdec_property_zval(zval *prop, zend_property_info *prop_
}
}
-static zend_never_inline void zend_post_incdec_overloaded_property(zval *object, zval *property, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_post_incdec_overloaded_property(zend_object *object, zend_string *name, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
{
- zval rv, obj;
+ zval rv;
zval *z;
zval z_copy;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z =object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
ZVAL_UNDEF(EX_VAR(opline->result.var));
return;
}
- if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
-
ZVAL_COPY_DEREF(&z_copy, z);
ZVAL_COPY(EX_VAR(opline->result.var), &z_copy);
if (ZEND_IS_INCREMENT(opline->opcode)) {
@@ -1831,38 +1766,28 @@ static zend_never_inline void zend_post_incdec_overloaded_property(zval *object,
} else {
decrement_function(&z_copy);
}
- Z_OBJ_HT(obj)->write_property(&obj, property, &z_copy, cache_slot);
- OBJ_RELEASE(Z_OBJ(obj));
+ object->handlers->write_property(object, name, &z_copy, cache_slot);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
}
-static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object, zval *property, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_pre_incdec_overloaded_property(zend_object *object, zend_string *name, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
{
zval rv;
- zval *z, obj;
+ zval *z;
zval z_copy;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z = object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
return;
}
- if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
-
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
ZVAL_COPY_DEREF(&z_copy, z);
if (ZEND_IS_INCREMENT(opline->opcode)) {
increment_function(&z_copy);
@@ -1872,45 +1797,35 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object,
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), &z_copy);
}
- Z_OBJ_HT(obj)->write_property(&obj, property, &z_copy, cache_slot);
- OBJ_RELEASE(Z_OBJ(obj));
+ object->handlers->write_property(object, name, &z_copy, cache_slot);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
}
-static zend_never_inline void zend_assign_op_overloaded_property(zval *object, zval *property, void **cache_slot, zval *value OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_assign_op_overloaded_property(zend_object *object, zend_string *name, void **cache_slot, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
zval *z;
- zval rv, obj, res;
+ zval rv, res;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z = object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return;
}
- if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
-
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
if (zend_binary_op(&res, z, value OPLINE_CC) == SUCCESS) {
- Z_OBJ_HT(obj)->write_property(&obj, property, &res, cache_slot);
+ object->handlers->write_property(object, name, &res, cache_slot);
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), &res);
}
zval_ptr_dtor(z);
zval_ptr_dtor(&res);
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
}
/* Utility Functions for Extensions */
@@ -1976,16 +1891,10 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call(z
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc)
{
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED,
- "Non-static method %s::%s() should not be called statically",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
- } else {
- zend_throw_error(
- zend_ce_error,
- "Non-static method %s::%s() cannot be called statically",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
- }
+ zend_throw_error(
+ zend_ce_error,
+ "Non-static method %s::%s() cannot be called statically",
+ ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num)
@@ -1999,17 +1908,17 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(con
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_scalar_as_array(void)
{
- zend_error(E_WARNING, "Cannot use a scalar value as an array");
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element(void)
{
- zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset(const zval *dim)
{
- zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_string(void)
@@ -2019,8 +1928,6 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_s
static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
{
- zend_free_op free_op_data1;
-
if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
if (opline->op2_type == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -2028,11 +1935,10 @@ static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
}
- } else if (EXPECTED(!Z_ISERROR_P(container))) {
+ } else {
zend_use_scalar_as_array();
}
- get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
}
static zend_never_inline zend_uchar slow_index_convert(const zval *dim, zend_value *value EXECUTE_DATA_DC)
@@ -2194,13 +2100,13 @@ fetch_from_array:
retval = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(retval == NULL)) {
zend_cannot_add_element();
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
} else {
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type EXECUTE_DATA_CC);
if (UNEXPECTED(!retval)) {
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
}
@@ -2215,7 +2121,7 @@ fetch_from_array:
if (type != BP_VAR_UNSET) {
if (ZEND_REF_HAS_TYPE_SOURCES(ref)) {
if (UNEXPECTED(!zend_verify_ref_array_assignable(ref))) {
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
}
@@ -2233,7 +2139,7 @@ fetch_from_array:
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
}
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (ZEND_CONST_COND(dim_type == IS_CV, dim != NULL) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
dim = ZVAL_UNDEFINED_OP2();
@@ -2241,7 +2147,7 @@ fetch_from_array:
if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
- retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, type, result);
if (UNEXPECTED(retval == &EG(uninitialized_zval))) {
zend_class_entry *ce = Z_OBJCE_P(container);
@@ -2265,7 +2171,8 @@ fetch_from_array:
ZVAL_INDIRECT(result, retval);
}
} else {
- ZVAL_ERROR(result);
+ ZEND_ASSERT(EG(exception) && "read_dimension() returned NULL without exception");
+ ZVAL_UNDEF(result);
}
} else {
if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -2283,15 +2190,13 @@ return_null:
}
ZVAL_NULL(result);
}
- } else if (EXPECTED(Z_ISERROR_P(container))) {
- ZVAL_ERROR(result);
} else {
if (type == BP_VAR_UNSET) {
- zend_error(E_WARNING, "Cannot unset offset in a non-array variable");
- ZVAL_NULL(result);
+ zend_throw_error(NULL, "Cannot unset offset in a non-array variable");
+ ZVAL_UNDEF(result);
} else {
zend_use_scalar_as_array();
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
}
}
}
@@ -2356,7 +2261,7 @@ try_string_offset:
case IS_FALSE:
case IS_TRUE:
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "String offset cast occurred");
+ zend_error(E_WARNING, "String offset cast occurred");
}
break;
case IS_REFERENCE:
@@ -2374,7 +2279,7 @@ try_string_offset:
if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
+ zend_error(E_WARNING, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
ZVAL_EMPTY_STRING(result);
} else {
ZVAL_NULL(result);
@@ -2396,7 +2301,7 @@ try_string_offset:
if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
- retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, type, result);
ZEND_ASSERT(result != NULL);
if (retval) {
@@ -2416,7 +2321,7 @@ try_string_offset:
ZVAL_UNDEFINED_OP2();
}
if (!is_list && type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Trying to access array offset on value of type %s",
+ zend_error(E_WARNING, "Trying to access array offset on value of type %s",
zend_zval_type_name(container));
}
ZVAL_NULL(result);
@@ -2476,7 +2381,7 @@ str_idx:
ZVAL_UNDEFINED_OP2();
goto str_idx;
} else {
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ zend_type_error("Illegal offset type in isset or empty");
return NULL;
}
}
@@ -2488,7 +2393,7 @@ static zend_never_inline int ZEND_FASTCALL zend_isset_dim_slow(zval *container,
}
if (/*OP1_TYPE != IS_CONST &&*/ EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
- return Z_OBJ_HT_P(container)->has_dimension(container, offset, 0);
+ return Z_OBJ_HT_P(container)->has_dimension(Z_OBJ_P(container), offset, 0);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zend_long lval;
@@ -2527,7 +2432,7 @@ static zend_never_inline int ZEND_FASTCALL zend_isempty_dim_slow(zval *container
}
if (/*OP1_TYPE != IS_CONST &&*/ EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
- return !Z_OBJ_HT_P(container)->has_dimension(container, offset, 1);
+ return !Z_OBJ_HT_P(container)->has_dimension(Z_OBJ_P(container), offset, 1);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zend_long lval;
@@ -2609,7 +2514,7 @@ static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_slow(zval
if (UNEXPECTED(Z_TYPE_INFO_P(subject) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
}
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "array_key_exists() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(subject)));
+ zend_type_error("array_key_exists() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(subject)));
return IS_NULL;
}
}
@@ -2619,33 +2524,11 @@ static zend_always_inline zend_bool promotes_to_array(zval *val) {
|| (Z_ISREF_P(val) && Z_TYPE_P(Z_REFVAL_P(val)) <= IS_FALSE);
}
-static zend_always_inline zend_bool promotes_to_object(zval *val) {
- ZVAL_DEREF(val);
- return Z_TYPE_P(val) <= IS_FALSE
- || (Z_TYPE_P(val) == IS_STRING && Z_STRLEN_P(val) == 0);
-}
-
static zend_always_inline zend_bool check_type_array_assignable(zend_type type) {
- if (!type) {
- return 1;
- }
- return ZEND_TYPE_IS_CODE(type)
- && (ZEND_TYPE_CODE(type) == IS_ARRAY || ZEND_TYPE_CODE(type) == IS_ITERABLE);
-}
-
-static zend_always_inline zend_bool check_type_stdClass_assignable(zend_type type) {
- if (!type) {
+ if (!ZEND_TYPE_IS_SET(type)) {
return 1;
}
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (ZEND_TYPE_IS_CE(type)) {
- return ZEND_TYPE_CE(type) == zend_standard_class_def;
- } else {
- return zend_string_equals_literal_ci(ZEND_TYPE_NAME(type), "stdclass");
- }
- } else {
- return ZEND_TYPE_CODE(type) == IS_OBJECT;
- }
+ return ZEND_TYPE_IS_MASK(type) && (ZEND_TYPE_MASK(type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY));
}
/* Checks whether an array can be assigned to the reference. Returns conflicting property if
@@ -2662,20 +2545,6 @@ static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_referen
return 1;
}
-/* Checks whether an stdClass can be assigned to the reference. Returns conflicting property if
- * assignment is not possible, NULL otherwise. */
-static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref) {
- zend_property_info *prop;
- ZEND_ASSERT(ZEND_REF_HAS_TYPE_SOURCES(ref));
- ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
- if (!check_type_stdClass_assignable(prop->type)) {
- zend_throw_auto_init_in_ref_error(prop, "stdClass");
- return 0;
- }
- } ZEND_REF_FOREACH_TYPE_SOURCES_END();
- return 1;
-}
-
static zend_property_info *zend_object_fetch_property_type_info(
zend_object *obj, zval *slot)
{
@@ -2711,21 +2580,6 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
}
}
break;
- case ZEND_FETCH_OBJ_WRITE:
- if (promotes_to_object(ptr)) {
- if (!prop_info) {
- prop_info = zend_object_fetch_property_type_info(obj, ptr);
- if (!prop_info) {
- break;
- }
- }
- if (!check_type_stdClass_assignable(prop_info->type)) {
- zend_throw_auto_init_in_prop_error(prop_info, "stdClass");
- if (result) ZVAL_ERROR(result);
- return 0;
- }
- }
- break;
case ZEND_FETCH_REF:
if (Z_TYPE_P(ptr) != IS_REFERENCE) {
if (!prop_info) {
@@ -2755,8 +2609,10 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type, uint32_t flags, zend_bool init_undef OPLINE_DC EXECUTE_DATA_DC)
{
zval *ptr;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
- if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
+ if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
do {
if (Z_ISREF_P(container) && Z_TYPE_P(Z_REFVAL_P(container)) == IS_OBJECT) {
container = Z_REFVAL_P(container);
@@ -2775,17 +2631,16 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
return;
}
- container = make_real_object(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!container)) {
- ZVAL_ERROR(result);
- return;
- }
+ zend_throw_non_object_error(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
+ ZVAL_ERROR(result);
+ return;
} while (0);
}
+
+ zobj = Z_OBJ_P(container);
if (prop_op_type == IS_CONST &&
- EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
+ EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
- zend_object *zobj = Z_OBJ_P(container);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) {
ptr = OBJ_PROP(zobj, prop_offset);
@@ -2813,9 +2668,15 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
}
- ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot);
+
+ if (prop_op_type == IS_CONST) {
+ name = Z_STR_P(prop_ptr);
+ } else {
+ name = zval_get_tmp_string(prop_ptr, &tmp_name);
+ }
+ ptr = zobj->handlers->get_property_ptr_ptr(zobj, name, type, cache_slot);
if (NULL == ptr) {
- ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
+ ptr = zobj->handlers->read_property(zobj, name, type, cache_slot, result);
if (ptr == result) {
if (UNEXPECTED(Z_ISREF_P(ptr) && Z_REFCOUNT_P(ptr) == 1)) {
ZVAL_UNREF(ptr);
@@ -2867,8 +2728,6 @@ static zend_always_inline void zend_assign_to_property_reference(zval *container
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
zval_ptr_dtor(&variable);
variable_ptr = &EG(uninitialized_zval);
- } else if (/*OP_DATA_TYPE == IS_VAR &&*/ UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (/*OP_DATA_TYPE == IS_VAR &&*/
(opline->extended_value & ZEND_RETURNS_FUNCTION) &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -2924,7 +2783,6 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co
}
static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) {
- zend_free_op free_op1;
zend_string *name, *tmp_name;
zend_class_entry *ce;
zend_property_info *property_info;
@@ -2966,7 +2824,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
if (EXPECTED(op1_type == IS_CONST)) {
name = Z_STR_P(RT_CONSTANT(opline, opline->op1));
} else {
- zval *varname = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ zval *varname = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
tmp_name = NULL;
@@ -2983,9 +2841,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
if (UNEXPECTED(op1_type != IS_CONST)) {
zend_tmp_string_release(tmp_name);
- if (op1_type != IS_CV) {
- zval_ptr_dtor_nogc(free_op1);
- }
+ FREE_OP(op1_type, opline->op1.var);
}
if (UNEXPECTED(*retval == NULL)) {
@@ -3012,7 +2868,8 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
property_info = CACHED_PTR(cache_slot + sizeof(void *) * 2);
if ((fetch_type == BP_VAR_R || fetch_type == BP_VAR_RW)
- && UNEXPECTED(Z_TYPE_P(*retval) == IS_UNDEF) && UNEXPECTED(property_info->type != 0)) {
+ && UNEXPECTED(Z_TYPE_P(*retval) == IS_UNDEF)
+ && UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) {
zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization",
ZSTR_VAL(property_info->ce->name),
zend_get_unmangled_property_name(property_info->name));
@@ -3025,7 +2882,7 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
}
}
- if (flags && property_info->type) {
+ if (flags && ZEND_TYPE_IS_SET(property_info->type)) {
zend_handle_fetch_obj_flags(NULL, *retval, NULL, property_info, flags);
}
@@ -3037,58 +2894,59 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
}
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv) {
- const char *prop1_type1, *prop1_type2, *prop2_type1, *prop2_type2;
- zend_format_type(prop1->type, &prop1_type1, &prop1_type2);
- zend_format_type(prop2->type, &prop2_type1, &prop2_type2);
- zend_type_error("Reference with value of type %s held by property %s::$%s of type %s%s is not compatible with property %s::$%s of type %s%s",
+ zend_string *type1_str = zend_type_to_string(prop1->type);
+ zend_string *type2_str = zend_type_to_string(prop2->type);
+ zend_type_error("Reference with value of type %s held by property %s::$%s of type %s is not compatible with property %s::$%s of type %s",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop1->ce->name),
zend_get_unmangled_property_name(prop1->name),
- prop1_type1, prop1_type2,
+ ZSTR_VAL(type1_str),
ZSTR_VAL(prop2->ce->name),
zend_get_unmangled_property_name(prop2->name),
- prop2_type1, prop2_type2
+ ZSTR_VAL(type2_str)
);
+ zend_string_release(type1_str);
+ zend_string_release(type2_str);
}
ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
- zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s%s",
+ zend_string *type_str = zend_type_to_string(prop->type);
+ zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info *prop1, zend_property_info *prop2, zval *zv) {
- const char *prop1_type1, *prop1_type2, *prop2_type1, *prop2_type2;
- zend_format_type(prop1->type, &prop1_type1, &prop1_type2);
- zend_format_type(prop2->type, &prop2_type1, &prop2_type2);
- zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s%s and property %s::$%s of type %s%s, as this would result in an inconsistent type conversion",
+ zend_string *type1_str = zend_type_to_string(prop1->type);
+ zend_string *type2_str = zend_type_to_string(prop2->type);
+ zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s and property %s::$%s of type %s, as this would result in an inconsistent type conversion",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop1->ce->name),
zend_get_unmangled_property_name(prop1->name),
- prop1_type1, prop1_type2,
+ ZSTR_VAL(type1_str),
ZSTR_VAL(prop2->ce->name),
zend_get_unmangled_property_name(prop2->name),
- prop2_type1, prop2_type2
+ ZSTR_VAL(type2_str)
);
+ zend_string_release(type1_str);
+ zend_string_release(type2_str);
}
/* 1: valid, 0: invalid, -1: may be valid after type coercion */
static zend_always_inline int i_zend_verify_type_assignable_zval(
zend_type *type_ptr, zend_class_entry *self_ce, zval *zv, zend_bool strict) {
zend_type type = *type_ptr;
- zend_uchar type_code;
+ uint32_t type_mask;
zend_uchar zv_type = Z_TYPE_P(zv);
- if (ZEND_TYPE_ALLOW_NULL(type) && zv_type == IS_NULL) {
- return 1;
- }
-
if (ZEND_TYPE_IS_CLASS(type)) {
+ if (ZEND_TYPE_ALLOW_NULL(type) && zv_type == IS_NULL) {
+ return 1;
+ }
if (!ZEND_TYPE_IS_CE(type)) {
if (!zend_resolve_class_type(type_ptr, self_ce)) {
return 0;
@@ -3098,26 +2956,25 @@ static zend_always_inline int i_zend_verify_type_assignable_zval(
return zv_type == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), ZEND_TYPE_CE(type));
}
- type_code = ZEND_TYPE_CODE(type);
- if (type_code == zv_type ||
- (type_code == _IS_BOOL && (zv_type == IS_FALSE || zv_type == IS_TRUE))) {
+ if (ZEND_TYPE_CONTAINS_CODE(type, zv_type)) {
return 1;
}
- if (type_code == IS_ITERABLE) {
+ type_mask = ZEND_TYPE_MASK(type);
+ if (type_mask & MAY_BE_ITERABLE) {
return zend_is_iterable(zv);
}
/* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */
if (strict) {
- if (type_code == IS_DOUBLE && zv_type == IS_LONG) {
+ if ((type_mask & MAY_BE_DOUBLE) && zv_type == IS_LONG) {
return -1;
}
return 0;
}
/* No weak conversions for arrays and objects */
- if (type_code == IS_ARRAY || type_code == IS_OBJECT) {
+ if (type_mask & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
return 0;
}
@@ -3139,7 +2996,7 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference
* must be the same (modulo nullability). To handle this, remember the first type we see and
* compare against it when coercion becomes necessary. */
zend_property_info *seen_prop = NULL;
- zend_uchar seen_type;
+ uint32_t seen_type_mask;
zend_bool needs_coercion = 0;
ZEND_ASSERT(Z_TYPE_P(zv) != IS_REFERENCE);
@@ -3156,14 +3013,16 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference
if (!seen_prop) {
seen_prop = prop;
- seen_type = ZEND_TYPE_IS_CLASS(prop->type) ? IS_OBJECT : ZEND_TYPE_CODE(prop->type);
- } else if (needs_coercion && seen_type != ZEND_TYPE_CODE(prop->type)) {
+ seen_type_mask = ZEND_TYPE_IS_CLASS(prop->type)
+ ? MAY_BE_OBJECT : ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(prop->type));
+ } else if (needs_coercion
+ && seen_type_mask != ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(prop->type))) {
zend_throw_conflicting_coercion_error(seen_prop, prop, zv);
return 0;
}
} ZEND_REF_FOREACH_TYPE_SOURCES_END();
- if (UNEXPECTED(needs_coercion && !zend_verify_weak_scalar_type_hint(seen_type, zv))) {
+ if (UNEXPECTED(needs_coercion && !zend_verify_weak_scalar_type_hint(seen_type_mask, zv))) {
zend_throw_ref_type_error_zval(seen_prop, zv);
return 0;
}
@@ -3224,12 +3083,13 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert
if (result < 0) {
zend_property_info *ref_prop = ZEND_REF_FIRST_SOURCE(Z_REF_P(orig_val));
- if (ZEND_TYPE_CODE(prop_info->type) != ZEND_TYPE_CODE(ref_prop->type)) {
+ if (ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(prop_info->type))
+ != ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(ref_prop->type))) {
/* Invalid due to conflicting coercion */
zend_throw_ref_type_error_type(ref_prop, prop_info, val);
return 0;
}
- if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_CODE(prop_info->type), val)) {
+ if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_MASK(prop_info->type), val)) {
return 1;
}
}
@@ -3314,7 +3174,7 @@ static zend_never_inline void zend_fetch_this_var(int type OPLINE_DC EXECUTE_DAT
Z_ADDREF_P(result);
} else {
ZVAL_NULL(result);
- zend_error(E_NOTICE,"Undefined variable: this");
+ zend_error(E_WARNING, "Undefined variable: this");
}
break;
case BP_VAR_IS:
@@ -3919,7 +3779,8 @@ static void cleanup_live_vars(zend_execute_data *execute_data, uint32_t op_num,
}
} else if (kind == ZEND_LIVE_SILENCE) {
/* restore previous error_reporting value */
- if (!EG(error_reporting) && Z_LVAL_P(var) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(var))) {
EG(error_reporting) = Z_LVAL_P(var);
}
}
@@ -3995,9 +3856,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- return NULL;
- }
+ return NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
init_func_run_time_cache(&fbc->op_array);
@@ -4028,7 +3887,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
}
/* }}} */
-static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zval *function, uint32_t num_args) /* {{{ */
+static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zend_object *function, uint32_t num_args) /* {{{ */
{
zend_function *fbc;
void *object_or_called_scope;
@@ -4036,8 +3895,8 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zval *
zend_object *object;
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
- if (EXPECTED(Z_OBJ_HANDLER_P(function, get_closure)) &&
- EXPECTED(Z_OBJ_HANDLER_P(function, get_closure)(function, &called_scope, &fbc, &object) == SUCCESS)) {
+ if (EXPECTED(function->handlers->get_closure) &&
+ EXPECTED(function->handlers->get_closure(function, &called_scope, &fbc, &object, 0) == SUCCESS)) {
object_or_called_scope = called_scope;
if (fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -4119,9 +3978,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
}
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- return NULL;
- }
+ return NULL;
}
object_or_called_scope = called_scope;
} else {
@@ -4251,43 +4108,6 @@ already_compiled:
}
/* }}} */
-static ZEND_COLD int ZEND_FASTCALL zend_do_fcall_overloaded(zend_execute_data *call, zval *ret) /* {{{ */
-{
- zend_function *fbc = call->func;
- zend_object *object;
-
- /* Not sure what should be done here if it's a static method */
- if (UNEXPECTED(Z_TYPE(call->This) != IS_OBJECT)) {
- zend_vm_stack_free_args(call);
- if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(fbc->common.function_name, 0);
- }
- efree(fbc);
- zend_vm_stack_free_call_frame(call);
-
- zend_throw_error(NULL, "Cannot call overloaded function for non-object");
- return 0;
- }
-
- object = Z_OBJ(call->This);
-
- ZVAL_NULL(ret);
-
- EG(current_execute_data) = call;
- object->handlers->call_method(fbc->common.function_name, object, call, ret);
- EG(current_execute_data) = call->prev_execute_data;
-
- zend_vm_stack_free_args(call);
-
- if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(fbc->common.function_name, 0);
- }
- efree(fbc);
-
- return 1;
-}
-/* }}} */
-
static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_ptr, int by_ref OPLINE_DC EXECUTE_DATA_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(array_ptr);
@@ -4335,96 +4155,30 @@ static zend_always_inline int _zend_quick_get_constant(
const zval *key, uint32_t flags, int check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */
{
zval *zv;
- const zval *orig_key = key;
zend_constant *c = NULL;
+ /* null/true/false are resolved during compilation, so don't check for them here. */
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
if (zv) {
c = (zend_constant*)Z_PTR_P(zv);
- } else {
+ } else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
key++;
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) {
+ if (zv) {
c = (zend_constant*)Z_PTR_P(zv);
- } else {
- if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
- key++;
- zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv) {
- c = (zend_constant*)Z_PTR_P(zv);
- } else {
- key++;
- zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) {
- c = (zend_constant*)Z_PTR_P(zv);
- }
- }
- }
}
}
if (!c) {
if (!check_defined_only) {
- if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)));
- if (!actual) {
- ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2)));
- } else {
- actual++;
- ZVAL_STRINGL(EX_VAR(opline->result.var),
- actual, Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)) - (actual - Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))));
- }
- /* non-qualified constant - allow text substitution */
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)",
- Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
- } else {
- zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- }
+ zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return FAILURE;
}
if (!check_defined_only) {
ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value);
- if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST))) {
- const char *ns_sep;
- size_t shortname_offset;
- size_t shortname_len;
- zend_bool is_deprecated;
-
- if (flags & IS_CONSTANT_UNQUALIFIED) {
- const zval *access_key;
-
- if (!(flags & IS_CONSTANT_IN_NAMESPACE)) {
- access_key = orig_key - 1;
- } else {
- if (key < orig_key + 2) {
- goto check_short_name;
- } else {
- access_key = orig_key + 2;
- }
- }
- is_deprecated = !zend_string_equals(c->name, Z_STR_P(access_key));
- } else {
-check_short_name:
- ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
- ZEND_ASSERT(ns_sep);
- /* Namespaces are always case-insensitive. Only compare shortname. */
- shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
- shortname_len = ZSTR_LEN(c->name) - shortname_offset;
-
- is_deprecated = memcmp(ZSTR_VAL(c->name) + shortname_offset, Z_STRVAL_P(orig_key - 1) + shortname_offset, shortname_len) != 0;
- }
-
- if (is_deprecated) {
- zend_error(E_DEPRECATED,
- "Case-insensitive constants are deprecated. "
- "The correct casing for this constant is \"%s\"",
- ZSTR_VAL(c->name));
- return SUCCESS;
- }
- }
}
CACHE_PTR(opline->extended_value, c);
@@ -4492,68 +4246,68 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
OPLINE++
-#ifndef VM_SMART_OPCODES
-# define VM_SMART_OPCODES 1
-#endif
-
-#if VM_SMART_OPCODES
-# define ZEND_VM_REPEATABLE_OPCODE \
+#define ZEND_VM_REPEATABLE_OPCODE \
do {
-# define ZEND_VM_REPEAT_OPCODE(_opcode) \
+#define ZEND_VM_REPEAT_OPCODE(_opcode) \
} while (UNEXPECTED((++opline)->opcode == _opcode)); \
OPLINE = opline; \
ZEND_VM_CONTINUE()
-# define ZEND_VM_SMART_BRANCH(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ OPLINE = EX(opline); \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
if (_result) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
if (!(_result)) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
} else { \
- break; \
+ ZVAL_BOOL(EX_VAR(opline->result.var), _result); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
-# define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (_result) { \
+ OPLINE = EX(opline); \
+ } else if (_result) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
-# define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (!(_result)) { \
+ OPLINE = EX(opline); \
+ } else if (!(_result)) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
+#define ZEND_VM_SMART_BRANCH_NONE(_result, _check) do { \
+ ZVAL_BOOL(EX_VAR(opline->result.var), _result); \
+ ZEND_VM_NEXT_OPCODE_EX(_check, 1); \
+ ZEND_VM_CONTINUE(); \
+ } while (0)
#define ZEND_VM_SMART_BRANCH_TRUE() do { \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
- ZEND_VM_CONTINUE(); \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
- ZEND_VM_CONTINUE(); \
+ } else { \
+ ZVAL_TRUE(EX_VAR(opline->result.var)); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
+ ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_TRUE_JMPZ() do { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
@@ -4563,14 +4317,20 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
ZEND_VM_CONTINUE(); \
} while (0)
+#define ZEND_VM_SMART_BRANCH_TRUE_NONE() do { \
+ ZVAL_TRUE(EX_VAR(opline->result.var)); \
+ ZEND_VM_NEXT_OPCODE(); \
+ } while (0)
#define ZEND_VM_SMART_BRANCH_FALSE() do { \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
- ZEND_VM_CONTINUE(); \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
- ZEND_VM_CONTINUE(); \
+ } else { \
+ ZVAL_FALSE(EX_VAR(opline->result.var)); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
+ ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_FALSE_JMPZ() do { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
@@ -4580,15 +4340,10 @@ static zend_never_inline int ZEND_FASTCALL zend_quick_check_constant(
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
ZEND_VM_CONTINUE(); \
} while (0)
-#else
-# define ZEND_VM_REPEATABLE_OPCODE
-# define ZEND_VM_REPEAT_OPCODE(_opcode)
-# define ZEND_VM_SMART_BRANCH(_result, _check)
-# define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check)
-# define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check)
-# define ZEND_VM_SMART_BRANCH_TRUE()
-# define ZEND_VM_SMART_BRANCH_FALSE()
-#endif
+#define ZEND_VM_SMART_BRANCH_FALSE_NONE() do { \
+ ZVAL_FALSE(EX_VAR(opline->result.var)); \
+ ZEND_VM_NEXT_OPCODE(); \
+ } while (0)
#ifdef __GNUC__
# define ZEND_VM_GUARD(name) __asm__("#" #name)
@@ -4624,27 +4379,21 @@ ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode)
return zend_user_opcode_handlers[opcode];
}
-ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
+ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, int type)
{
zval *ret;
switch (op_type) {
case IS_CONST:
ret = RT_CONSTANT(opline, *node);
- *should_free = NULL;
break;
case IS_TMP_VAR:
case IS_VAR:
- ret = EX_VAR(node->var);
- *should_free = ret;
- break;
case IS_CV:
ret = EX_VAR(node->var);
- *should_free = NULL;
break;
default:
ret = NULL;
- *should_free = ret;
break;
}
return ret;
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 1ff9403f51..2342bbaba4 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -44,10 +44,10 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name);
-ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name);
-ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions);
-ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions);
+ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
+ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
+ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions);
+ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions);
/* export zend_pass_function to allow comparisons against it */
extern ZEND_API const zend_internal_function zend_pass_function;
@@ -60,6 +60,11 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert
ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv);
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv);
+ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg);
+ZEND_API ZEND_COLD void zend_verify_arg_error(
+ const zend_function *zf, const zend_arg_info *arg_info,
+ int arg_num, void **cache_slot, zval *value);
+
#define ZEND_REF_TYPE_SOURCES(ref) \
(ref)->sources
@@ -120,11 +125,6 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
break;
}
}
- if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
- UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value);
- return variable_ptr;
- }
garbage = Z_COUNTED_P(variable_ptr);
zend_copy_to_variable(variable_ptr, value, value_type, ref);
if (GC_DELREF(garbage) == 0) {
@@ -327,10 +327,7 @@ ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute
ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
-/* former zend_execute_locks.h */
-typedef zval* zend_free_op;
-
-ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type);
+ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, int type);
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index d9e0d0a8aa..4551085675 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -179,8 +179,6 @@ void init_executor(void) /* {{{ */
EG(ht_iterators) = EG(ht_iterators_slots);
memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots)));
- EG(each_deprecation_thrown) = 0;
-
EG(persistent_constants_count) = EG(zend_constants)->nNumUsed;
EG(persistent_functions_count) = EG(function_table)->nNumUsed;
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
@@ -568,29 +566,10 @@ ZEND_API ZEND_COLD int zend_use_undefined_constant(zend_string *name, zend_ast_a
} else if ((colon = (char*)zend_memrchr(ZSTR_VAL(name), ':', ZSTR_LEN(name)))) {
zend_throw_error(NULL, "Undefined class constant '%s'", ZSTR_VAL(name));
return FAILURE;
- } else if ((attr & IS_CONSTANT_UNQUALIFIED) == 0) {
+ } else {
zend_throw_error(NULL, "Undefined constant '%s'", ZSTR_VAL(name));
return FAILURE;
- } else {
- char *actual = ZSTR_VAL(name);
- size_t actual_len = ZSTR_LEN(name);
- char *slash = (char *) zend_memrchr(actual, '\\', actual_len);
-
- if (slash) {
- actual = slash + 1;
- actual_len -= (actual - ZSTR_VAL(name));
- }
-
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual);
- if (EG(exception)) {
- return FAILURE;
- } else {
- zend_string *result_str = zend_string_init(actual, actual_len, 0);
- zval_ptr_dtor_nogc(result);
- ZVAL_NEW_STR(result, result_str);
- }
}
- return SUCCESS;
}
/* }}} */
@@ -707,20 +686,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
return FAILURE;
- } else if (error) {
- /* Capitalize the first latter of the error message */
- if (error[0] >= 'a' && error[0] <= 'z') {
- error[0] += ('A' - 'a');
- }
- zend_error(E_DEPRECATED, "%s", error);
- efree(error);
- if (UNEXPECTED(EG(exception))) {
- if (EG(current_execute_data) == &dummy_execute_data) {
- EG(current_execute_data) = dummy_execute_data.prev_execute_data;
- }
- return FAILURE;
- }
}
+
+ ZEND_ASSERT(!error);
}
func = fci_cache->function_handler;
@@ -814,8 +782,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
/* We must re-initialize function again */
fci_cache->function_handler = NULL;
}
- } else if (func->type == ZEND_INTERNAL_FUNCTION) {
+ } else {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
+
+ ZEND_ASSERT(func->type == ZEND_INTERNAL_FUNCTION);
ZVAL_NULL(fci->retval);
call->prev_execute_data = EG(current_execute_data);
EG(current_execute_data) = call;
@@ -837,30 +807,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
/* We must re-initialize function again */
fci_cache->function_handler = NULL;
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ZVAL_NULL(fci->retval);
-
- /* Not sure what should be done here if it's a static method */
- if (fci->object) {
- call->prev_execute_data = EG(current_execute_data);
- EG(current_execute_data) = call;
- fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval);
- EG(current_execute_data) = call->prev_execute_data;
- } else {
- zend_throw_error(NULL, "Cannot call overloaded function for non-object");
- }
-
- zend_vm_stack_free_args(call);
-
- if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(func->common.function_name, 0);
- }
- efree(func);
-
- if (EG(exception)) {
- zval_ptr_dtor(fci->retval);
- ZVAL_UNDEF(fci->retval);
- }
}
zend_vm_stack_free_call_frame(call);
@@ -935,16 +881,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
}
if (!EG(autoload_func)) {
- zend_function *func = zend_fetch_function(ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
-
- if (func) {
- EG(autoload_func) = func;
- } else {
- if (!key) {
- zend_string_release_ex(lc_name, 0);
- }
- return NULL;
+ if (!key) {
+ zend_string_release_ex(lc_name, 0);
}
+ return NULL;
}
@@ -1046,7 +986,7 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */
}
/* }}} */
-ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name) /* {{{ */
+ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */
{
zval pv;
zend_op_array *new_op_array;
@@ -1110,13 +1050,13 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
}
/* }}} */
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name) /* {{{ */
+ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */
{
return zend_eval_stringl(str, strlen(str), retval_ptr, string_name);
}
/* }}} */
-ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
+ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */
{
int result;
@@ -1129,7 +1069,7 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c
}
/* }}} */
-ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
+ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */
{
return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions);
}
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
index 19cbf557c5..87c7748c36 100644
--- a/Zend/zend_extensions.h
+++ b/Zend/zend_extensions.h
@@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi
/* The first number is the engine version and the rest is the date (YYYYMMDD).
* This way engine 2/3 API no. is always greater than engine 1 API no.. */
-#define ZEND_EXTENSION_API_NO 320190902
+#define ZEND_EXTENSION_API_NO 420190128
typedef struct _zend_extension_version_info {
int zend_extension_api_no;
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index 8b242c003d..496d855d31 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -702,10 +702,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
ht = NULL;
@@ -822,10 +820,8 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_GREY))) {
ht = NULL;
@@ -1008,10 +1004,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(!GC_REF_CHECK_COLOR(ht, GC_GREY))) {
ht = NULL;
@@ -1171,7 +1165,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
/* optimization: color is GC_BLACK (0) */
if (!GC_INFO(ref)) {
@@ -1182,8 +1175,7 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
|| obj->ce->destructor != NULL)) {
*flags |= GC_HAS_DESTRUCTORS;
}
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
ht = NULL;
@@ -1357,10 +1349,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return count;
diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c
new file mode 100644
index 0000000000..0fff742048
--- /dev/null
+++ b/Zend/zend_gdb.c
@@ -0,0 +1,141 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@zend.com> |
+ | Xinchen Hui <xinchen.h@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "zend.h"
+#include "zend_gdb.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+enum {
+ ZEND_GDBJIT_NOACTION,
+ ZEND_GDBJIT_REGISTER,
+ ZEND_GDBJIT_UNREGISTER
+};
+
+typedef struct _zend_gdbjit_code_entry {
+ struct _zend_gdbjit_code_entry *next_entry;
+ struct _zend_gdbjit_code_entry *prev_entry;
+ const char *symfile_addr;
+ uint64_t symfile_size;
+} zend_gdbjit_code_entry;
+
+typedef struct _zend_gdbjit_descriptor {
+ uint32_t version;
+ uint32_t action_flag;
+ struct _zend_gdbjit_code_entry *relevant_entry;
+ struct _zend_gdbjit_code_entry *first_entry;
+} zend_gdbjit_descriptor;
+
+ZEND_API zend_gdbjit_descriptor __jit_debug_descriptor = {
+ 1, ZEND_GDBJIT_NOACTION, NULL, NULL
+};
+
+ZEND_API zend_never_inline void __jit_debug_register_code()
+{
+ __asm__ __volatile__("");
+}
+
+ZEND_API int zend_gdb_register_code(const void *object, size_t size)
+{
+ zend_gdbjit_code_entry *entry;
+
+ entry = malloc(sizeof(zend_gdbjit_code_entry) + size);
+ if (entry == NULL) {
+ return 0;
+ }
+
+ entry->symfile_addr = ((char*)entry) + sizeof(zend_gdbjit_code_entry);
+ entry->symfile_size = size;
+
+ memcpy((char *)entry->symfile_addr, object, size);
+
+ entry->prev_entry = NULL;
+ entry->next_entry = __jit_debug_descriptor.first_entry;
+
+ if (entry->next_entry) {
+ entry->next_entry->prev_entry = entry;
+ }
+ __jit_debug_descriptor.first_entry = entry;
+
+ /* Notify GDB */
+ __jit_debug_descriptor.relevant_entry = entry;
+ __jit_debug_descriptor.action_flag = ZEND_GDBJIT_REGISTER;
+ __jit_debug_register_code();
+
+ return 1;
+}
+
+ZEND_API void zend_gdb_unregister_all(void)
+{
+ zend_gdbjit_code_entry *entry;
+
+ __jit_debug_descriptor.action_flag = ZEND_GDBJIT_UNREGISTER;
+ while ((entry = __jit_debug_descriptor.first_entry)) {
+ __jit_debug_descriptor.first_entry = entry->next_entry;
+ if (entry->next_entry) {
+ entry->next_entry->prev_entry = NULL;
+ }
+ /* Notify GDB */
+ __jit_debug_descriptor.relevant_entry = entry;
+ __jit_debug_register_code();
+
+ free(entry);
+ }
+}
+
+ZEND_API int zend_gdb_present(void)
+{
+ int ret = 0;
+ int fd = open("/proc/self/status", O_RDONLY);
+
+ if (fd > 0) {
+ char buf[1024];
+ ssize_t n = read(fd, buf, sizeof(buf) - 1);
+ char *s;
+ pid_t pid;
+
+ if (n > 0) {
+ buf[n] = 0;
+ s = strstr(buf, "TracerPid:");
+ if (s) {
+ s += sizeof("TracerPid:") - 1;
+ while (*s == ' ' || *s == '\t') {
+ s++;
+ }
+ pid = atoi(s);
+ if (pid) {
+ char out[1024];
+ sprintf(buf, "/proc/%d/exe", (int)pid);
+ if (readlink(buf, out, sizeof(out) - 1) > 0) {
+ if (strstr(out, "gdb")) {
+ ret = 1;
+ }
+ }
+ }
+ }
+ }
+
+ close(fd);
+ }
+
+ return ret;
+}
diff --git a/Zend/zend_gdb.h b/Zend/zend_gdb.h
new file mode 100644
index 0000000000..220b70888f
--- /dev/null
+++ b/Zend/zend_gdb.h
@@ -0,0 +1,27 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@zend.com> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_GDB
+#define ZEND_GDB
+
+ZEND_API int zend_gdb_register_code(const void *object, size_t size);
+ZEND_API void zend_gdb_unregister_all(void);
+ZEND_API int zend_gdb_present(void);
+
+#endif
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 25413c5b00..432c1198d9 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -23,6 +23,7 @@
#include "zend_exceptions.h"
#include "zend_generators.h"
#include "zend_closures.h"
+#include "zend_generators_arginfo.h"
ZEND_API zend_class_entry *zend_ce_generator;
ZEND_API zend_class_entry *zend_ce_ClosedGeneratorException;
@@ -303,9 +304,9 @@ static uint32_t calc_gc_buffer_size(zend_generator *generator) /* {{{ */
}
/* }}} */
-static HashTable *zend_generator_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *zend_generator_get_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
- zend_generator *generator = (zend_generator*) Z_OBJ_P(object);
+ zend_generator *generator = (zend_generator*)object;
zend_execute_data *execute_data = generator->execute_data;
zend_op_array *op_array;
zval *gc_buffer;
@@ -1007,7 +1008,7 @@ ZEND_METHOD(Generator, throw)
zend_generator *generator;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(exception)
+ Z_PARAM_OBJECT_OF_CLASS(exception, zend_ce_throwable);
ZEND_PARSE_PARAMETERS_END();
Z_TRY_ADDREF_P(exception);
@@ -1172,26 +1173,15 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
}
/* }}} */
-ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_throw, 0, 0, 1)
- ZEND_ARG_INFO(0, exception)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry generator_functions[] = {
- ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, throw, arginfo_generator_throw, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, getReturn,arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, rewind, arginfo_class_Generator_rewind, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, valid, arginfo_class_Generator_valid, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, current, arginfo_class_Generator_current, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, key, arginfo_class_Generator_key, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, next, arginfo_class_Generator_next, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, send, arginfo_class_Generator_send, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, throw, arginfo_class_Generator_throw, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, getReturn,arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php
new file mode 100644
index 0000000000..759bd4cd48
--- /dev/null
+++ b/Zend/zend_generators.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+final class Generator implements Iterator
+{
+ function rewind(): void {}
+
+ function valid(): bool {}
+
+ function current() {}
+
+ function key() {}
+
+ function next(): void {}
+
+ function send($value) {}
+
+ function throw(Throwable $exception) {}
+
+ function getReturn() {}
+}
diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h
new file mode 100644
index 0000000000..56d4ddeccf
--- /dev/null
+++ b/Zend/zend_generators_arginfo.h
@@ -0,0 +1,22 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_valid arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_current arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_key arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_next arginfo_class_Generator_rewind
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_send, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, exception, Throwable, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_getReturn arginfo_class_Generator_rewind
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 6332a6f14d..9a55924f42 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -232,8 +232,6 @@ struct _zend_executor_globals {
zend_function trampoline;
zend_op call_trampoline_op;
- zend_bool each_deprecation_thrown;
-
HashTable weakrefs;
zend_bool exception_ignore_args;
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index c2c8cf825f..79a2f52d6c 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -234,7 +234,7 @@ static zend_always_inline void _zend_hash_init_int(HashTable *ht, uint32_t nSize
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nInternalPointer = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->pDestructor = pDestructor;
ht->nTableSize = zend_hash_check_size(nSize);
}
@@ -964,6 +964,10 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
IS_CONSISTENT(ht);
HT_ASSERT_RC1(ht);
+ if ((flag & HASH_ADD_NEXT) && h == ZEND_LONG_MIN) {
+ h = 0;
+ }
+
if (HT_FLAGS(ht) & HASH_FLAG_PACKED) {
if (h < ht->nNumUsed) {
p = ht->arData + h;
@@ -1028,8 +1032,8 @@ convert_to_hash:
p = ht->arData + idx;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
- if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
+ if ((zend_long)h >= ht->nNextFreeElement) {
+ ht->nNextFreeElement = (zend_long)h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
add:
ht->nNumOfElements++;
@@ -1168,7 +1172,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
}
}
-ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
+ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
{
Bucket *p;
uint32_t nIndex, i;
@@ -1180,7 +1184,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
ht->nNumUsed = 0;
HT_HASH_RESET(ht);
}
- return SUCCESS;
+ return;
}
HT_HASH_RESET(ht);
@@ -1258,7 +1262,6 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
_zend_hash_iterators_update(ht, old_num_used, ht->nNumUsed);
}
}
- return SUCCESS;
}
static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint32_t idx, Bucket *p, Bucket *prev)
@@ -1702,7 +1705,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->nInternalPointer = 0;
}
@@ -1741,7 +1744,7 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht)
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->nInternalPointer = 0;
}
@@ -2055,7 +2058,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
target->nTableMask = HT_MIN_MASK;
target->nNumUsed = 0;
target->nNumOfElements = 0;
- target->nNextFreeElement = 0;
+ target->nNextFreeElement = ZEND_LONG_MIN;
target->nInternalPointer = 0;
target->nTableSize = HT_MIN_SIZE;
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
@@ -2465,7 +2468,7 @@ ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q)
q->h = h;
}
-ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, compare_func_t compar, zend_bool renumber)
+ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, compare_func_t compar, zend_bool renumber)
{
Bucket *p;
uint32_t i, j;
@@ -2474,7 +2477,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, co
HT_ASSERT_RC1(ht);
if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
- return SUCCESS;
+ return;
}
if (HT_IS_WITHOUT_HOLES(ht)) {
@@ -2529,8 +2532,6 @@ ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, co
zend_hash_rehash(ht);
}
}
-
- return SUCCESS;
}
static zend_always_inline int zend_hash_compare_impl(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered) {
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index f1e2d34685..7263c47a82 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -265,7 +265,7 @@ ZEND_API void zend_hash_bucket_swap(Bucket *p, Bucket *q);
ZEND_API void zend_hash_bucket_renum_swap(Bucket *p, Bucket *q);
ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered);
-ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber);
+ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber);
ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
#define zend_hash_sort(ht, compare_func, renumber) \
@@ -277,7 +277,7 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_
#define zend_hash_next_free_element(ht) \
(ht)->nNextFreeElement
-ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht);
+ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht);
#if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P)
# define zend_new_array(size) \
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
index 92a4dbccd3..8ea1518ca6 100644
--- a/Zend/zend_highlight.h
+++ b/Zend/zend_highlight.h
@@ -39,8 +39,8 @@ typedef struct _zend_syntax_highlighter_ini {
BEGIN_EXTERN_C()
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
ZEND_API void zend_strip(void);
-ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
-ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name);
+ZEND_API int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
+ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name);
ZEND_API void zend_html_putc(char c);
ZEND_API void zend_html_puts(const char *s, size_t len);
END_EXTERN_C()
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index cc85af6859..5f9389ed6e 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -29,8 +29,7 @@
static void add_dependency_obligation(zend_class_entry *ce, zend_class_entry *dependency_ce);
static void add_compatibility_obligation(
- zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn,
- zend_bool always_error);
+ zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn);
static void add_property_compatibility_obligation(
zend_class_entry *ce, const zend_property_info *child_prop,
const zend_property_info *parent_prop);
@@ -342,7 +341,7 @@ static inheritance_status zend_perform_covariant_type_check(
}
return unlinked_instanceof(fe_ce, proto_ce) ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- } else if (ZEND_TYPE_CODE(proto_type) == IS_ITERABLE) {
+ } else if (ZEND_TYPE_MASK(proto_type) & MAY_BE_ITERABLE) {
if (ZEND_TYPE_IS_CLASS(fe_type)) {
zend_string *fe_class_name =
resolve_class_name(fe->common.scope, ZEND_TYPE_NAME(fe_type));
@@ -355,9 +354,9 @@ static inheritance_status zend_perform_covariant_type_check(
? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
}
- return ZEND_TYPE_CODE(fe_type) == IS_ITERABLE || ZEND_TYPE_CODE(fe_type) == IS_ARRAY
+ return ZEND_TYPE_MASK(fe_type) & (MAY_BE_ARRAY|MAY_BE_ITERABLE)
? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- } else if (ZEND_TYPE_CODE(proto_type) == IS_OBJECT) {
+ } else if (ZEND_TYPE_MASK(proto_type) & MAY_BE_OBJECT) {
if (ZEND_TYPE_IS_CLASS(fe_type)) {
/* Currently, any class name would be allowed here. We still perform a class lookup
* for forward-compatibility reasons, as we may have named types in the future that
@@ -372,9 +371,10 @@ static inheritance_status zend_perform_covariant_type_check(
return INHERITANCE_SUCCESS;
}
- return ZEND_TYPE_CODE(fe_type) == IS_OBJECT ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
+ return ZEND_TYPE_MASK(fe_type) & MAY_BE_OBJECT ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
} else {
- return ZEND_TYPE_CODE(fe_type) == ZEND_TYPE_CODE(proto_type)
+ return ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(fe_type))
+ == ZEND_TYPE_MASK(ZEND_TYPE_WITHOUT_NULL(proto_type))
? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
}
}
@@ -512,33 +512,10 @@ static inheritance_status zend_do_perform_implementation_check(
static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */
{
-
- if (ZEND_TYPE_IS_SET(arg_info->type) && ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_appendc(str, '?');
- }
-
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- const char *class_name;
- size_t class_name_len;
-
- class_name = ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type));
- class_name_len = ZSTR_LEN(ZEND_TYPE_NAME(arg_info->type));
-
- if (!strcasecmp(class_name, "self") && fptr->common.scope) {
- class_name = ZSTR_VAL(fptr->common.scope->name);
- class_name_len = ZSTR_LEN(fptr->common.scope->name);
- } else if (!strcasecmp(class_name, "parent") && fptr->common.scope && fptr->common.scope->parent) {
- class_name = ZSTR_VAL(fptr->common.scope->parent->name);
- class_name_len = ZSTR_LEN(fptr->common.scope->parent->name);
- }
-
- smart_str_appendl(str, class_name, class_name_len);
- if (!return_hint) {
- smart_str_appendc(str, ' ');
- }
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- const char *type_name = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type));
- smart_str_appends(str, type_name);
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string_resolved(arg_info->type, fptr->common.scope);
+ smart_str_append(str, type_str);
+ zend_string_release(type_str);
if (!return_hint) {
smart_str_appendc(str, ' ');
}
@@ -676,49 +653,26 @@ static zend_always_inline uint32_t func_lineno(const zend_function *fn) {
}
static void ZEND_COLD emit_incompatible_method_error(
- int error_level, const char *error_verb,
const zend_function *child, const zend_function *parent,
inheritance_status status, zend_string *unresolved_class) {
zend_string *parent_prototype = zend_get_function_declaration(parent);
zend_string *child_prototype = zend_get_function_declaration(child);
if (status == INHERITANCE_UNRESOLVED) {
- zend_error_at(error_level, NULL, func_lineno(child),
+ zend_error_at(E_COMPILE_ERROR, NULL, func_lineno(child),
"Could not check compatibility between %s and %s, because class %s is not available",
ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype), ZSTR_VAL(unresolved_class));
} else {
- zend_error_at(error_level, NULL, func_lineno(child),
- "Declaration of %s %s be compatible with %s",
- ZSTR_VAL(child_prototype), error_verb, ZSTR_VAL(parent_prototype));
+ zend_error_at(E_COMPILE_ERROR, NULL, func_lineno(child),
+ "Declaration of %s must be compatible with %s",
+ ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype));
}
zend_string_efree(child_prototype);
zend_string_efree(parent_prototype);
}
-static void ZEND_COLD emit_incompatible_method_error_or_warning(
- const zend_function *child, const zend_function *parent,
- inheritance_status status, zend_string *unresolved_class, zend_bool always_error) {
- int error_level;
- const char *error_verb;
- if (always_error ||
- (child->common.prototype &&
- (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) ||
- ((parent->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) &&
- (!(child->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
- zend_perform_covariant_type_check(&unresolved_class, child, child->common.arg_info - 1, parent, parent->common.arg_info - 1) != INHERITANCE_SUCCESS))
- ) {
- error_level = E_COMPILE_ERROR;
- error_verb = "must";
- } else {
- error_level = E_WARNING;
- error_verb = "should";
- }
- emit_incompatible_method_error(
- error_level, error_verb, child, parent, status, unresolved_class);
-}
-
static void perform_delayable_implementation_check(
zend_class_entry *ce, const zend_function *fe,
- const zend_function *proto, zend_bool always_error)
+ const zend_function *proto)
{
zend_string *unresolved_class;
inheritance_status status = zend_do_perform_implementation_check(
@@ -726,16 +680,11 @@ static void perform_delayable_implementation_check(
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- add_compatibility_obligation(ce, fe, proto, always_error);
+ add_compatibility_obligation(ce, fe, proto);
} else {
ZEND_ASSERT(status == INHERITANCE_ERROR);
- if (always_error) {
- emit_incompatible_method_error(
- E_COMPILE_ERROR, "must", fe, proto, status, unresolved_class);
- } else {
- emit_incompatible_method_error_or_warning(
- fe, proto, status, unresolved_class, always_error);
- }
+ emit_incompatible_method_error(
+ fe, proto, status, unresolved_class);
}
}
}
@@ -839,8 +788,7 @@ static zend_always_inline inheritance_status do_inheritance_check_on_method_ex(z
return zend_do_perform_implementation_check(
&unresolved_class, child, parent);
}
- perform_delayable_implementation_check(
- ce, child, parent, /*always_error*/0);
+ perform_delayable_implementation_check(ce, child, parent);
}
return INHERITANCE_SUCCESS;
}
@@ -924,14 +872,12 @@ inheritance_status property_types_compatible(
static void emit_incompatible_property_error(
const zend_property_info *child, const zend_property_info *parent) {
+ zend_string *type_str = zend_type_to_string_resolved(parent->type, parent->ce);
zend_error_noreturn(E_COMPILE_ERROR,
- "Type of %s::$%s must be %s%s (as in class %s)",
+ "Type of %s::$%s must be %s (as in class %s)",
ZSTR_VAL(child->ce->name),
ZSTR_VAL(child->name),
- ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(parent->type)
- ? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))
- : zend_get_type_by_const(ZEND_TYPE_CODE(parent->type)),
+ ZSTR_VAL(type_str),
ZSTR_VAL(parent->ce->name));
}
@@ -1493,14 +1439,11 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
ce->serialize_func = fe;
} else if (zend_string_equals_literal(mname, "unserialize")) {
ce->unserialize_func = fe;
- } else if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_')) {
+ } else if (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_') {
/* pass */
} else if (zend_string_equals_literal(mname, ZEND_CLONE_FUNC_NAME)) {
ce->clone = fe;
} else if (zend_string_equals_literal(mname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
- if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
- }
ce->constructor = fe;
} else if (zend_string_equals_literal(mname, ZEND_DESTRUCTOR_FUNC_NAME)) {
ce->destructor = fe;
@@ -1524,17 +1467,6 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
ce->__tostring = fe;
} else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) {
ce->__debugInfo = fe;
- } else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) {
- zend_string *lowercase_name = zend_string_tolower(ce->name);
- lowercase_name = zend_new_interned_string(lowercase_name);
- if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) {
- if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
- }
- ce->constructor = fe;
- fe->common.fn_flags |= ZEND_ACC_CTOR;
- }
- zend_string_release_ex(lowercase_name, 0);
}
}
/* }}} */
@@ -1560,13 +1492,11 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
if ((existing_fn = zend_hash_find_ptr(*overridden, key)) != NULL) {
if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
- perform_delayable_implementation_check(
- ce, fn, existing_fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, fn, existing_fn);
}
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the abstract declaration is compatible with previous declaration */
- perform_delayable_implementation_check(
- ce, existing_fn, fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, existing_fn, fn);
return;
}
}
@@ -1579,12 +1509,10 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT &&
(existing_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0) {
/* Make sure the trait method is compatible with previosly declared abstract method */
- perform_delayable_implementation_check(
- ce, fn, existing_fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, fn, existing_fn);
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the abstract declaration is compatible with previous declaration */
- perform_delayable_implementation_check(
- ce, existing_fn, fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, existing_fn, fn);
return;
} else if (UNEXPECTED(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) {
/* two traits can't define the same non-abstract method */
@@ -2132,32 +2060,6 @@ static void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */
zend_do_traits_property_binding(ce, traits);
efree(traits);
-
- /* Emit E_DEPRECATED for PHP 4 constructors */
- zend_check_deprecated_constructor(ce);
-}
-/* }}} */
-
-
-static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* {{{ */
-{
- const zend_string *constructor_name;
- if (!ce->constructor) {
- return 0;
- }
- constructor_name = ce->constructor->common.function_name;
- return !zend_binary_strcasecmp(
- ZSTR_VAL(ce->name), ZSTR_LEN(ce->name),
- ZSTR_VAL(constructor_name), ZSTR_LEN(constructor_name)
- );
-}
-/* }}} */
-
-void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */
-{
- if (zend_has_deprecated_constructor(ce)) {
- zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name));
- }
}
/* }}} */
@@ -2233,7 +2135,6 @@ typedef struct {
struct {
const zend_function *parent_fn;
const zend_function *child_fn;
- zend_bool always_error;
};
struct {
const zend_property_info *parent_prop;
@@ -2281,14 +2182,12 @@ static void add_dependency_obligation(zend_class_entry *ce, zend_class_entry *de
}
static void add_compatibility_obligation(
- zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn,
- zend_bool always_error) {
+ zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn) {
HashTable *obligations = get_or_init_obligations_for_class(ce);
variance_obligation *obligation = emalloc(sizeof(variance_obligation));
obligation->type = OBLIGATION_COMPATIBILITY;
obligation->child_fn = child_fn;
obligation->parent_fn = parent_fn;
- obligation->always_error = always_error;
zend_hash_next_index_insert_ptr(obligations, obligation);
}
@@ -2319,15 +2218,13 @@ static int check_variance_obligation(zval *zv) {
zend_string *unresolved_class;
inheritance_status status = zend_do_perform_implementation_check(
&unresolved_class, obligation->child_fn, obligation->parent_fn);
-
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
return ZEND_HASH_APPLY_KEEP;
}
ZEND_ASSERT(status == INHERITANCE_ERROR);
- emit_incompatible_method_error_or_warning(
- obligation->child_fn, obligation->parent_fn, status, unresolved_class,
- obligation->always_error);
+ emit_incompatible_method_error(
+ obligation->child_fn, obligation->parent_fn, status, unresolved_class);
}
/* Either the compatibility check was successful or only threw a warning. */
} else {
@@ -2398,9 +2295,8 @@ static void report_variance_errors(zend_class_entry *ce) {
status = zend_do_perform_implementation_check(
&unresolved_class, obligation->child_fn, obligation->parent_fn);
ZEND_ASSERT(status == INHERITANCE_UNRESOLVED);
- emit_incompatible_method_error_or_warning(
- obligation->child_fn, obligation->parent_fn,
- status, unresolved_class, obligation->always_error);
+ emit_incompatible_method_error(
+ obligation->child_fn, obligation->parent_fn, status, unresolved_class);
} else if (obligation->type == OBLIGATION_PROPERTY_COMPATIBILITY) {
emit_incompatible_property_error(obligation->child_prop, obligation->parent_prop);
} else {
@@ -2513,7 +2409,6 @@ ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_nam
/* Check whether early binding is prevented due to unresolved types in inheritance checks. */
static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce) /* {{{ */
{
- inheritance_status ret = INHERITANCE_SUCCESS;
zend_string *key;
zend_function *parent_func;
zend_property_info *parent_info;
@@ -2526,11 +2421,7 @@ static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_e
do_inheritance_check_on_method_ex(child_func, parent_func, ce, NULL, 1, 0);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
- if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- return INHERITANCE_UNRESOLVED;
- }
- ZEND_ASSERT(status == INHERITANCE_ERROR);
- ret = INHERITANCE_ERROR;
+ return status;
}
}
} ZEND_HASH_FOREACH_END();
@@ -2547,17 +2438,13 @@ static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_e
if (ZEND_TYPE_IS_SET(child_info->type)) {
inheritance_status status = property_types_compatible(parent_info, child_info);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
- if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- return INHERITANCE_UNRESOLVED;
- }
- ZEND_ASSERT(status == INHERITANCE_ERROR);
- ret = INHERITANCE_ERROR;
+ return status;
}
}
}
} ZEND_HASH_FOREACH_END();
- return ret;
+ return INHERITANCE_SUCCESS;
}
/* }}} */
diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h
index c4e9e10675..6cf2d1b78d 100644
--- a/Zend/zend_inheritance.h
+++ b/Zend/zend_inheritance.h
@@ -33,7 +33,6 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name);
void zend_verify_abstract_class(zend_class_entry *ce);
-void zend_check_deprecated_constructor(const zend_class_entry *ce);
void zend_build_properties_info_table(zend_class_entry *ce);
zend_bool zend_try_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce, zend_string *lcname, zval *delayed_early_binding);
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index ff6784be31..5d58b3e178 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -20,6 +20,7 @@
#include "zend_API.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"
+#include "zend_interfaces_arginfo.h"
ZEND_API zend_class_entry *zend_ce_traversable;
ZEND_API zend_class_entry *zend_ce_aggregate;
@@ -30,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_countable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
-ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
+ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
{
int result;
zend_fcall_info fci;
@@ -45,7 +46,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
}
fci.size = sizeof(fci);
- fci.object = object ? Z_OBJ_P(object) : NULL;
+ fci.object = object;
fci.retval = retval_ptr ? retval_ptr : &retval;
fci.param_count = param_count;
fci.params = params;
@@ -62,7 +63,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
ZVAL_UNDEF(&fci.function_name); /* Unused */
if (!obj_ce) {
- obj_ce = object ? Z_OBJCE_P(object) : NULL;
+ obj_ce = object ? object->ce : NULL;
}
if (!fn_proxy || !*fn_proxy) {
if (EXPECTED(obj_ce)) {
@@ -87,7 +88,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
}
if (object) {
- fcic.called_scope = Z_OBJCE_P(object);
+ fcic.called_scope = object->ce;
} else {
zend_class_entry *called_scope = zend_get_called_scope(EG(current_execute_data));
@@ -99,13 +100,13 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
fcic.called_scope = called_scope;
}
}
- fcic.object = object ? Z_OBJ_P(object) : NULL;
+ fcic.object = object;
result = zend_call_function(&fci, &fcic);
}
if (result == FAILURE) {
/* error at c-level */
if (!obj_ce) {
- obj_ce = object ? Z_OBJCE_P(object) : NULL;
+ obj_ce = object ? object->ce : NULL;
}
if (!EG(exception)) {
zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name);
@@ -124,7 +125,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
/* {{{ zend_user_it_new_iterator */
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval)
{
- zend_call_method_with_0_params(object, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval);
}
/* }}} */
@@ -160,7 +161,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter)
zval more;
int result;
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more);
result = i_zend_is_true(&more);
zval_ptr_dtor(&more);
return result ? SUCCESS : FAILURE;
@@ -176,7 +177,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter)
zval *object = &iter->it.data;
if (Z_ISUNDEF(iter->value)) {
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value);
}
return &iter->value;
}
@@ -189,7 +190,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
zval *object = &iter->it.data;
zval retval;
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
ZVAL_ZVAL(key, &retval, 1, 1);
@@ -210,7 +211,7 @@ ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter)
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter);
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL);
}
/* }}} */
@@ -221,7 +222,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter)
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter);
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
}
/* }}} */
@@ -438,7 +439,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b
zval retval;
int result;
- zend_call_method_with_0_params(object, ce, &ce->serialize_func, "serialize", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->serialize_func, "serialize", &retval);
if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) {
@@ -479,7 +480,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
ZVAL_STRINGL(&zdata, (char*)buf, buf_len);
- zend_call_method_with_1_params(object, ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
+ zend_call_method_with_1_params(Z_OBJ_P(object), ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
zval_ptr_dtor(&zdata);
@@ -533,57 +534,37 @@ static int zend_implement_countable(zend_class_entry *interface, zend_class_entr
/* {{{ function tables */
static const zend_function_entry zend_funcs_aggregate[] = {
- ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
+ ZEND_ABSTRACT_ME(iterator, getIterator, arginfo_class_IteratorAggregate_getIterator)
ZEND_FE_END
};
static const zend_function_entry zend_funcs_iterator[] = {
- ZEND_ABSTRACT_ME(iterator, current, NULL)
- ZEND_ABSTRACT_ME(iterator, next, NULL)
- ZEND_ABSTRACT_ME(iterator, key, NULL)
- ZEND_ABSTRACT_ME(iterator, valid, NULL)
- ZEND_ABSTRACT_ME(iterator, rewind, NULL)
+ ZEND_ABSTRACT_ME(iterator, current, arginfo_class_Iterator_current)
+ ZEND_ABSTRACT_ME(iterator, next, arginfo_class_Iterator_next)
+ ZEND_ABSTRACT_ME(iterator, key, arginfo_class_Iterator_key)
+ ZEND_ABSTRACT_ME(iterator, valid, arginfo_class_Iterator_valid)
+ ZEND_ABSTRACT_ME(iterator, rewind, arginfo_class_Iterator_rewind)
ZEND_FE_END
};
static const zend_function_entry *zend_funcs_traversable = NULL;
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_get, 0, 0, 1) /* actually this should be return by ref but atm cannot be */
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_value, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_arrayaccess[] = {
- ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset)
- ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset_get)
- ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value)
- ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_class_ArrayAccess_offsetExists)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_class_ArrayAccess_offsetGet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_class_ArrayAccess_offsetSet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_class_ArrayAccess_offsetUnset)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_serializable[] = {
- ZEND_ABSTRACT_ME(serializable, serialize, NULL)
- ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME(serializable, serialize, arginfo_class_Serializable_serialize)
+ ZEND_FENTRY(unserialize, NULL, arginfo_class_Serializable_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_countable_count, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_countable[] = {
- ZEND_ABSTRACT_ME(Countable, count, arginfo_countable_count)
+ ZEND_ABSTRACT_ME(Countable, count, arginfo_class_Countable_count)
ZEND_FE_END
};
/* }}} */
diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h
index 44770a1813..e7d0315ac5 100644
--- a/Zend/zend_interfaces.h
+++ b/Zend/zend_interfaces.h
@@ -37,7 +37,7 @@ typedef struct _zend_user_iterator {
zval value;
} zend_user_iterator;
-ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2);
+ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2);
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL)
diff --git a/Zend/zend_interfaces.stub.php b/Zend/zend_interfaces.stub.php
new file mode 100644
index 0000000000..882a21e600
--- /dev/null
+++ b/Zend/zend_interfaces.stub.php
@@ -0,0 +1,51 @@
+<?php
+
+interface Traversable {}
+
+interface IteratorAggregate extends Traversable
+{
+ /** @return Traversable */
+ function getIterator();
+}
+
+interface Iterator extends Traversable
+{
+ function current();
+
+ /** @return void */
+ function next();
+
+ function key();
+
+ /** @return bool */
+ function valid();
+
+ /** @return void */
+ function rewind();
+}
+
+interface ArrayAccess
+{
+ function offsetExists($offset);
+
+ /* actually this should be return by ref but atm cannot be */
+ function offsetGet($offset);
+
+ function offsetSet($offset, $value);
+
+ function offsetUnset($offset);
+}
+
+interface Serializable
+{
+ /** @return string */
+ function serialize();
+
+ function unserialize(string $serialized);
+}
+
+interface Countable
+{
+ /** @return int */
+ function count();
+}
diff --git a/Zend/zend_interfaces_arginfo.h b/Zend/zend_interfaces_arginfo.h
new file mode 100644
index 0000000000..fee57057af
--- /dev/null
+++ b/Zend/zend_interfaces_arginfo.h
@@ -0,0 +1,35 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Iterator_current arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_next arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_key arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_valid arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_rewind arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetGet arginfo_class_ArrayAccess_offsetExists
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetUnset arginfo_class_ArrayAccess_offsetExists
+
+#define arginfo_class_Serializable_serialize arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_unserialize, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Countable_count arginfo_class_IteratorAggregate_getIterator
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index 379a316c38..c0bb418f3a 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -24,7 +24,7 @@ static zend_class_entry zend_iterator_class_entry;
static void iter_wrapper_free(zend_object *object);
static void iter_wrapper_dtor(zend_object *object);
-static HashTable *iter_wrapper_get_gc(zval *object, zval **table, int *n);
+static HashTable *iter_wrapper_get_gc(zend_object *object, zval **table, int *n);
static const zend_object_handlers iterator_object_handlers = {
0,
@@ -36,18 +36,14 @@ static const zend_object_handlers iterator_object_handlers = {
NULL, /* read dim */
NULL, /* write dim */
NULL,
- NULL, /* get */
- NULL, /* set */
NULL, /* has prop */
NULL, /* unset prop */
NULL, /* has dim */
NULL, /* unset dim */
NULL, /* props get */
NULL, /* method get */
- NULL, /* call */
NULL, /* get ctor */
NULL, /* get class name */
- NULL, /* compare */
NULL, /* cast */
NULL, /* count */
NULL, /* get_debug_info */
@@ -72,7 +68,7 @@ static void iter_wrapper_dtor(zend_object *object)
{
}
-static HashTable *iter_wrapper_get_gc(zval *object, zval **table, int *n) {
+static HashTable *iter_wrapper_get_gc(zend_object *object, zval **table, int *n) {
/* TODO: We need a get_gc iterator handler */
*table = NULL;
*n = 0;
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index f3bb663e0c..0f35b69adf 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -70,8 +70,9 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%left '&'
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
+%left '.'
%left T_SL T_SR
-%left '+' '-' '.'
+%left '+' '-'
%left '*' '/' '%'
%precedence '!'
%precedence T_INSTANCEOF
@@ -965,7 +966,6 @@ expr:
| '(' expr ')' {
$$ = $2;
if ($$->kind == ZEND_AST_CONDITIONAL) $$->attr = ZEND_PARENTHESIZED_CONDITIONAL;
- if ($$->kind == ZEND_AST_BINARY_OP && $$->attr == ZEND_CONCAT) $$->attr = ZEND_PARENTHESIZED_CONCAT;
}
| new_expr { $$ = $1; }
| expr '?' expr ':' expr
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index 3640b9a5ea..4d51a064fc 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -66,7 +66,7 @@ typedef struct _zend_heredoc_label {
BEGIN_EXTERN_C()
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename);
+ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename);
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
ZEND_API void zend_lex_tstring(zval *zv);
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 7dcb4dfcee..f2a3d15c74 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -685,7 +685,7 @@ zend_op_array *compile_filename(int type, zval *filename)
return retval;
}
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
+ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename)
{
char *buf;
size_t size, old_len;
@@ -753,7 +753,7 @@ ZEND_API size_t zend_get_scanned_file_offset(void)
return offset;
}
-zend_op_array *compile_string(zval *source_string, char *filename)
+zend_op_array *compile_string(zval *source_string, const char *filename)
{
zend_lex_state original_lex_state;
zend_op_array *op_array = NULL;
@@ -784,7 +784,7 @@ zend_op_array *compile_string(zval *source_string, char *filename)
BEGIN_EXTERN_C()
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
+int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
{
zend_lex_state original_lex_state;
zend_file_handle file_handle;
@@ -806,7 +806,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
return SUCCESS;
}
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name)
+int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name)
{
zend_lex_state original_lex_state;
zval tmp;
@@ -2859,14 +2859,7 @@ nowdoc_scan_done:
RETURN_TOKEN(END);
}
- if (!SCNG(heredoc_scan_ahead)) {
- zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
- }
- if (PARSER_MODE()) {
- goto restart;
- } else {
- RETURN_TOKEN(T_BAD_CHARACTER);
- }
+ RETURN_TOKEN(T_BAD_CHARACTER);
}
*/
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 21d013a589..2288cf6913 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -113,7 +113,7 @@ ZEND_API void *zend_fetch_resource2(zend_resource *res, const char *resource_typ
if (resource_type_name) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
@@ -128,7 +128,7 @@ ZEND_API void *zend_fetch_resource(zend_resource *res, const char *resource_type
if (resource_type_name) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
@@ -140,14 +140,14 @@ ZEND_API void *zend_fetch_resource_ex(zval *res, const char *resource_type_name,
if (res == NULL) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
if (Z_TYPE_P(res) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
@@ -161,14 +161,14 @@ ZEND_API void *zend_fetch_resource2_ex(zval *res, const char *resource_type_name
if (res == NULL) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
if (Z_TYPE_P(res) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
@@ -209,6 +209,7 @@ void plist_entry_destructor(zval *zv)
ZEND_API int zend_init_rsrc_list(void)
{
zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0);
+ EG(regular_list).nNextFreeElement = 0;
return SUCCESS;
}
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
index 908acd7d32..047d9d77ce 100644
--- a/Zend/zend_modules.h
+++ b/Zend/zend_modules.h
@@ -31,7 +31,7 @@
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module
-#define ZEND_MODULE_API_NO 20190902
+#define ZEND_MODULE_API_NO 20190128
#ifdef ZTS
#define USING_ZTS 1
#else
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 09984390c9..3df9160180 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -104,10 +104,8 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
}
/* }}} */
-ZEND_API HashTable *zend_std_get_properties(zval *object) /* {{{ */
+ZEND_API HashTable *zend_std_get_properties(zend_object *zobj) /* {{{ */
{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
if (!zobj->properties) {
rebuild_object_properties(zobj);
}
@@ -115,15 +113,13 @@ ZEND_API HashTable *zend_std_get_properties(zval *object) /* {{{ */
}
/* }}} */
-ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ */
+ZEND_API HashTable *zend_std_get_gc(zend_object *zobj, zval **table, int *n) /* {{{ */
{
- if (Z_OBJ_HANDLER_P(object, get_properties) != zend_std_get_properties) {
+ if (zobj->handlers->get_properties != zend_std_get_properties) {
*table = NULL;
*n = 0;
- return Z_OBJ_HANDLER_P(object, get_properties)(object);
+ return zobj->handlers->get_properties(zobj);
} else {
- zend_object *zobj = Z_OBJ_P(object);
-
if (zobj->properties) {
*table = NULL;
*n = 0;
@@ -142,15 +138,15 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ *
}
/* }}} */
-ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ */
+ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
+ zend_class_entry *ce = object->ce;
zval retval;
HashTable *ht;
if (!ce->__debugInfo) {
*is_temp = 0;
- return Z_OBJ_HANDLER_P(object, get_properties)(object);
+ return object->handlers->get_properties(object);
}
zend_call_method_with_0_params(object, ce, &ce->__debugInfo, ZEND_DEBUGINFO_FUNC_NAME, &retval);
@@ -458,7 +454,7 @@ found:
}
offset = property_info->offset;
- if (EXPECTED(!property_info->type)) {
+ if (EXPECTED(!ZEND_TYPE_IS_SET(property_info->type))) {
property_info = NULL;
} else {
*info_ptr = property_info;
@@ -652,23 +648,16 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
}
/* }}} */
-ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *retval;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
uint32_t *guard = NULL;
-
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return &EG(uninitialized_zval);
- }
+ zend_string *tmp_name = NULL;
#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), ZSTR_VAL(name));
+ fprintf(stderr, "Read object #%d property: %s\n", zobj->handle, ZSTR_VAL(name));
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
@@ -788,7 +777,7 @@ call_getter:
ZSTR_VAL(prop_info->ce->name),
ZSTR_VAL(name));
} else {
- zend_error(E_NOTICE,"Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
retval = &EG(uninitialized_zval);
@@ -800,21 +789,13 @@ exit:
}
/* }}} */
-ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+ZEND_API zval *zend_std_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *variable_ptr, tmp;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
ZEND_ASSERT(!Z_ISREF_P(value));
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return value;
- }
-
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__set != NULL), cache_slot, &prop_info);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) {
@@ -902,7 +883,6 @@ write_std_property:
}
exit:
- zend_tmp_string_release(tmp_name);
return variable_ptr;
}
/* }}} */
@@ -913,10 +893,10 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry *
}
/* }}} */
-ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if (offset == NULL) {
@@ -926,17 +906,16 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
ZVAL_COPY_DEREF(&tmp_offset, offset);
}
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
+ GC_ADDREF(object);
if (type == BP_VAR_IS) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", rv, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, &tmp_offset);
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
return NULL;
}
if (!i_zend_is_true(rv)) {
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
zval_ptr_dtor(rv);
return &EG(uninitialized_zval);
@@ -944,9 +923,9 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
zval_ptr_dtor(rv);
}
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", rv, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", rv, &tmp_offset);
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) {
@@ -963,10 +942,10 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
}
/* }}} */
-ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
if (!offset) {
@@ -974,10 +953,9 @@ ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value)
} else {
ZVAL_COPY_DEREF(&tmp_offset, offset);
}
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
- zval_ptr_dtor(&tmp_object);
+ GC_ADDREF(object);
+ zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -985,25 +963,24 @@ ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value)
}
/* }}} */
-ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval retval, tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval retval, tmp_offset;
int result;
if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", &retval, &tmp_offset);
+ GC_ADDREF(object);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, &tmp_offset);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", &retval, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, &tmp_offset);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
}
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -1013,22 +990,14 @@ ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty)
}
/* }}} */
-ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *retval = NULL;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return &EG(error_zval);
- }
-
#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), ZSTR_VAL(name));
+ fprintf(stderr, "Ptr object #%d property: %s\n", object->handle, ZSTR_VAL(name));
#endif
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot, &prop_info);
@@ -1040,7 +1009,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
ZVAL_NULL(retval);
- zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
} else {
/* we do have getter - fail and let it try again with usual get/set */
@@ -1056,7 +1025,6 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
zobj->properties = zend_array_dup(zobj->properties);
}
if (EXPECTED((retval = zend_hash_find(zobj->properties, name)) != NULL)) {
- zend_tmp_string_release(tmp_name);
return retval;
}
}
@@ -1069,31 +1037,22 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
/* 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)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
} else if (zobj->ce->__get == NULL) {
retval = &EG(error_zval);
}
- zend_tmp_string_release(tmp_name);
return retval;
}
/* }}} */
-ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return;
- }
-
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__unset != NULL), cache_slot, &prop_info);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) {
@@ -1111,7 +1070,7 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
if (zobj->properties) {
HT_FLAGS(zobj->properties) |= HASH_FLAG_HAS_EMPTY_IND;
}
- goto exit;
+ return;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))
&& EXPECTED(zobj->properties != NULL)) {
@@ -1122,10 +1081,10 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
zobj->properties = zend_array_dup(zobj->properties);
}
if (EXPECTED(zend_hash_del(zobj->properties, name) != FAILURE)) {
- goto exit;
+ return;
}
} else if (UNEXPECTED(EG(exception))) {
- goto exit;
+ return;
}
/* magic unset */
@@ -1140,28 +1099,24 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
/* Trigger the correct error */
zend_wrong_offset(zobj->ce, name);
ZEND_ASSERT(EG(exception));
- goto exit;
+ return;
} else {
/* Nothing to do: The property already does not exist. */
}
}
-
-exit:
- zend_tmp_string_release(tmp_name);
}
/* }}} */
-ZEND_API void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
+ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetunset", NULL, &tmp_offset);
- zval_ptr_dtor(&tmp_object);
+ GC_ADDREF(object);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, &tmp_offset);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -1281,6 +1236,13 @@ static ZEND_COLD zend_never_inline void zend_bad_method_call(zend_function *fbc,
}
/* }}} */
+static ZEND_COLD zend_never_inline void zend_abstract_method_call(zend_function *fbc) /* {{{ */
+{
+ zend_throw_error(NULL, "Cannot call abstract method %s::%s()",
+ ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
+}
+/* }}} */
+
ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key) /* {{{ */
{
zend_object *zobj = *obj_ptr;
@@ -1341,6 +1303,10 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
}
exit:
+ if (fbc && UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ zend_abstract_method_call(fbc);
+ fbc = NULL;
+ }
if (UNEXPECTED(!key)) {
ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
}
@@ -1426,6 +1392,11 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
}
+ if (fbc && UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ zend_abstract_method_call(fbc);
+ fbc = NULL;
+ }
+
if (UNEXPECTED(!key)) {
zend_string_release_ex(lc_function_name, 0);
}
@@ -1513,7 +1484,7 @@ undeclared_property:
ZVAL_DEINDIRECT(ret);
if (UNEXPECTED((type == BP_VAR_R || type == BP_VAR_RW)
- && Z_TYPE_P(ret) == IS_UNDEF && property_info->type != 0)) {
+ && Z_TYPE_P(ret) == IS_UNDEF && ZEND_TYPE_IS_SET(property_info->type))) {
zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization",
ZSTR_VAL(property_info->ce->name),
zend_get_unmangled_property_name(property_name));
@@ -1577,6 +1548,33 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
{
zend_object *zobj1, *zobj2;
+ if (Z_TYPE_P(o1) != Z_TYPE_P(o2)) {
+ /* Object and non-object */
+ zval casted;
+ if (Z_TYPE_P(o1) == IS_OBJECT) {
+ ZEND_ASSERT(Z_TYPE_P(o2) != IS_OBJECT);
+ if (Z_OBJ_HT_P(o1)->cast_object) {
+ if (Z_OBJ_HT_P(o1)->cast_object(Z_OBJ_P(o1), &casted, ((Z_TYPE_P(o2) == IS_FALSE || Z_TYPE_P(o2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(o2))) == FAILURE) {
+ return 1;
+ }
+ int ret = zend_compare(&casted, o2);
+ zval_ptr_dtor(&casted);
+ return ret;
+ }
+ } else {
+ ZEND_ASSERT(Z_TYPE_P(o2) == IS_OBJECT);
+ if (Z_OBJ_HT_P(o2)->cast_object) {
+ if (Z_OBJ_HT_P(o2)->cast_object(Z_OBJ_P(o2), &casted, ((Z_TYPE_P(o1) == IS_FALSE || Z_TYPE_P(o1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(o1))) == FAILURE) {
+ return -1;
+ }
+ int ret = zend_compare(o1, &casted);
+ zval_ptr_dtor(&casted);
+ return ret;
+ }
+ }
+ return 1;
+ }
+
zobj1 = Z_OBJ_P(o1);
zobj2 = Z_OBJ_P(o2);
@@ -1613,15 +1611,12 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
if (Z_TYPE_P(p1) != IS_UNDEF) {
if (Z_TYPE_P(p2) != IS_UNDEF) {
- zval result;
+ int ret;
- if (compare_function(&result, p1, p2)==FAILURE) {
- Z_UNPROTECT_RECURSION_P(o1);
- return 1;
- }
- if (Z_LVAL(result) != 0) {
+ ret = zend_compare(p1, p2);
+ if (ret != 0) {
Z_UNPROTECT_RECURSION_P(o1);
- return Z_LVAL(result);
+ return ret;
}
} else {
Z_UNPROTECT_RECURSION_P(o1);
@@ -1649,20 +1644,13 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-ZEND_API int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
int result;
zval *value = NULL;
- zend_string *name, *tmp_name;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
-
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return 0;
- }
+ zend_string *tmp_name = NULL;
property_offset = zend_get_property_offset(zobj->ce, name, 1, cache_slot, &prop_info);
@@ -1759,14 +1747,14 @@ ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj) /* {{{ */
}
/* }}} */
-ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type) /* {{{ */
+ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
zval retval;
zend_class_entry *ce;
switch (type) {
case IS_STRING:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
if (ce->__tostring) {
zend_call_method_with_0_params(readobj, ce, &ce->__tostring, "__tostring", &retval);
if (EXPECTED(Z_TYPE(retval) == IS_STRING)) {
@@ -1783,17 +1771,17 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
ZVAL_TRUE(writeobj);
return SUCCESS;
case IS_LONG:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ZSTR_VAL(ce->name));
ZVAL_LONG(writeobj, 1);
return SUCCESS;
case IS_DOUBLE:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to float", ZSTR_VAL(ce->name));
ZVAL_DOUBLE(writeobj, 1);
return SUCCESS;
case _IS_NUMBER:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to number", ZSTR_VAL(ce->name));
ZVAL_LONG(writeobj, 1);
return SUCCESS;
@@ -1805,10 +1793,10 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
}
/* }}} */
-ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
zval *func;
- zend_class_entry *ce = Z_OBJCE_P(obj);
+ zend_class_entry *ce = obj->ce;
if ((func = zend_hash_find_ex(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE), 1)) == NULL) {
return FAILURE;
@@ -1822,20 +1810,20 @@ ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_fun
}
} else {
if (obj_ptr) {
- *obj_ptr = Z_OBJ_P(obj);
+ *obj_ptr = obj;
}
}
return SUCCESS;
}
/* }}} */
-ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose purpose) {
+ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose) {
HashTable *ht;
switch (purpose) {
case ZEND_PROP_PURPOSE_DEBUG:
- if (Z_OBJ_HT_P(obj)->get_debug_info) {
+ if (obj->handlers->get_debug_info) {
int is_temp;
- ht = Z_OBJ_HT_P(obj)->get_debug_info(obj, &is_temp);
+ ht = obj->handlers->get_debug_info(obj, &is_temp);
if (ht && !is_temp && !(GC_FLAGS(ht) & GC_IMMUTABLE)) {
GC_ADDREF(ht);
}
@@ -1847,7 +1835,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose pur
case ZEND_PROP_PURPOSE_VAR_EXPORT:
case ZEND_PROP_PURPOSE_JSON:
case _ZEND_PROP_PURPOSE_ARRAY_KEY_EXISTS:
- ht = Z_OBJ_HT_P(obj)->get_properties(obj);
+ ht = obj->handlers->get_properties(obj);
if (ht && !(GC_FLAGS(ht) & GC_IMMUTABLE)) {
GC_ADDREF(ht);
}
@@ -1859,11 +1847,13 @@ ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose pur
}
ZEND_API HashTable *zend_get_properties_for(zval *obj, zend_prop_purpose purpose) {
- if (Z_OBJ_HT_P(obj)->get_properties_for) {
- return Z_OBJ_HT_P(obj)->get_properties_for(obj, purpose);
+ zend_object *zobj = Z_OBJ_P(obj);
+
+ if (zobj->handlers->get_properties_for) {
+ return zobj->handlers->get_properties_for(zobj, purpose);
}
- return zend_std_get_properties_for(obj, purpose);
+ return zend_std_get_properties_for(zobj, purpose);
}
ZEND_API const zend_object_handlers std_object_handlers = {
@@ -1878,24 +1868,20 @@ ZEND_API const zend_object_handlers std_object_handlers = {
zend_std_read_dimension, /* read_dimension */
zend_std_write_dimension, /* write_dimension */
zend_std_get_property_ptr_ptr, /* get_property_ptr_ptr */
- NULL, /* get */
- NULL, /* set */
zend_std_has_property, /* has_property */
zend_std_unset_property, /* unset_property */
zend_std_has_dimension, /* has_dimension */
zend_std_unset_dimension, /* unset_dimension */
zend_std_get_properties, /* get_properties */
zend_std_get_method, /* get_method */
- NULL, /* call_method */
zend_std_get_constructor, /* get_constructor */
zend_std_get_class_name, /* get_class_name */
- zend_std_compare_objects, /* compare_objects */
zend_std_cast_object_tostring, /* cast_object */
NULL, /* count_elements */
zend_std_get_debug_info, /* get_debug_info */
zend_std_get_closure, /* get_closure */
zend_std_get_gc, /* get_gc */
NULL, /* do_operation */
- NULL, /* compare */
+ zend_std_compare_objects, /* compare */
NULL, /* get_properties_for */
};
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 770a67cbdd..713669f297 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -41,10 +41,10 @@ struct _zend_property_info;
symbol table, its reference count should be 0.
*/
/* Used to fetch property from the object, read-only */
-typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, void **cache_slot, zval *rv);
+typedef zval *(*zend_object_read_property_t)(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
/* Used to fetch dimension from the object, read-only */
-typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int type, zval *rv);
+typedef zval *(*zend_object_read_dimension_t)(zend_object *object, zval *offset, int type, zval *rv);
/* The following rule applies to write_property() and write_dimension() implementations:
@@ -54,23 +54,14 @@ typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int ty
You must return the final value of the assigned property.
*/
/* Used to set property of the object */
-typedef zval *(*zend_object_write_property_t)(zval *object, zval *member, zval *value, void **cache_slot);
+typedef zval *(*zend_object_write_property_t)(zend_object *object, zend_string *member, zval *value, void **cache_slot);
/* Used to set dimension of the object */
-typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value);
+typedef void (*zend_object_write_dimension_t)(zend_object *object, zval *offset, zval *value);
/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, void **cache_slot);
-
-/* Used to set object value. Can be used to override assignments and scalar
- write ops (like ++, +=) on the object */
-typedef void (*zend_object_set_t)(zval *object, zval *value);
-
-/* Used to get object value. Can be used when converting object value to
- * one of the basic types and when using scalar ops (like ++, +=) on the object
- */
-typedef zval* (*zend_object_get_t)(zval *object, zval *rv);
+typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_string *member, int type, void **cache_slot);
/* Used to check if a property of the object exists */
/* param has_set_exists:
@@ -78,21 +69,21 @@ typedef zval* (*zend_object_get_t)(zval *object, zval *rv);
* 1 (set) whether property exists and is true
* 2 (exists) whether property exists
*/
-typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, void **cache_slot);
+typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
/* Used to check if a dimension of the object exists */
-typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty);
+typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, int check_empty);
/* Used to remove a property of the object */
-typedef void (*zend_object_unset_property_t)(zval *object, zval *member, void **cache_slot);
+typedef void (*zend_object_unset_property_t)(zend_object *object, zend_string *member, void **cache_slot);
/* Used to remove a dimension of the object */
-typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset);
+typedef void (*zend_object_unset_dimension_t)(zend_object *object, zval *offset);
/* Used to get hash of the properties of the object, as hash of zval's */
-typedef HashTable *(*zend_object_get_properties_t)(zval *object);
+typedef HashTable *(*zend_object_get_properties_t)(zend_object *object);
-typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp);
+typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp);
typedef enum _zend_prop_purpose {
/* Used for debugging. Supersedes get_debug_info handler. */
@@ -114,40 +105,38 @@ typedef enum _zend_prop_purpose {
} zend_prop_purpose;
/* The return value must be released using zend_release_properties(). */
-typedef zend_array *(*zend_object_get_properties_for_t)(zval *object, zend_prop_purpose purpose);
+typedef zend_array *(*zend_object_get_properties_for_t)(zend_object *object, zend_prop_purpose purpose);
/* Used to call methods */
/* args on stack! */
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
-typedef int (*zend_object_call_method_t)(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS);
typedef zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);
typedef zend_function *(*zend_object_get_constructor_t)(zend_object *object);
/* Object maintenance/destruction */
typedef void (*zend_object_dtor_obj_t)(zend_object *object);
typedef void (*zend_object_free_obj_t)(zend_object *object);
-typedef zend_object* (*zend_object_clone_obj_t)(zval *object);
+typedef zend_object* (*zend_object_clone_obj_t)(zend_object *object);
/* Get class name for display in var_dump and other debugging functions.
* Must be defined and must return a non-NULL value. */
typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2);
-typedef int (*zend_object_compare_zvals_t)(zval *result, zval *op1, zval *op2);
/* Cast an object to some other type.
* readobj and retval must point to distinct zvals.
*/
-typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type);
+typedef int (*zend_object_cast_t)(zend_object *readobj, zval *retval, int type);
/* updates *count to hold the number of elements present and returns SUCCESS.
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
-typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count);
+typedef int (*zend_object_count_elements_t)(zend_object *object, zend_long *count);
-typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr);
+typedef int (*zend_object_get_closure_t)(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
-typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval **table, int *n);
+typedef HashTable *(*zend_object_get_gc_t)(zend_object *object, zval **table, int *n);
typedef int (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2);
@@ -163,25 +152,21 @@ struct _zend_object_handlers {
zend_object_read_dimension_t read_dimension; /* required */
zend_object_write_dimension_t write_dimension; /* required */
zend_object_get_property_ptr_ptr_t get_property_ptr_ptr; /* required */
- zend_object_get_t get; /* optional */
- zend_object_set_t set; /* optional */
zend_object_has_property_t has_property; /* required */
zend_object_unset_property_t unset_property; /* required */
zend_object_has_dimension_t has_dimension; /* required */
zend_object_unset_dimension_t unset_dimension; /* required */
zend_object_get_properties_t get_properties; /* required */
zend_object_get_method_t get_method; /* required */
- zend_object_call_method_t call_method; /* optional */
zend_object_get_constructor_t get_constructor; /* required */
zend_object_get_class_name_t get_class_name; /* required */
- zend_object_compare_t compare_objects; /* optional */
zend_object_cast_t cast_object; /* optional */
zend_object_count_elements_t count_elements; /* optional */
zend_object_get_debug_info_t get_debug_info; /* optional */
zend_object_get_closure_t get_closure; /* optional */
zend_object_get_gc_t get_gc; /* required */
zend_object_do_operation_t do_operation; /* optional */
- zend_object_compare_zvals_t compare; /* optional */
+ zend_object_compare_t compare; /* required */
zend_object_get_properties_for_t get_properties_for; /* optional */
};
@@ -205,23 +190,23 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name);
ZEND_API zend_function *zend_std_get_constructor(zend_object *object);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent);
-ZEND_API HashTable *zend_std_get_properties(zval *object);
-ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n);
-ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp);
-ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type);
-ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
-ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-ZEND_API int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot);
-ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_slot);
-ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv);
-ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value);
-ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty);
-ZEND_API void zend_std_unset_dimension(zval *object, zval *offset);
+ZEND_API HashTable *zend_std_get_properties(zend_object *object);
+ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n);
+ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp);
+ZEND_API int zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type);
+ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
+ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+ZEND_API zval *zend_std_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
+ZEND_API int zend_std_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
+ZEND_API void zend_std_unset_property(zend_object *object, zend_string *member, void **cache_slot);
+ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
+ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value);
+ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty);
+ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset);
ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key);
ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj);
ZEND_API int zend_std_compare_objects(zval *o1, zval *o2);
-ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr);
+ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
ZEND_API void rebuild_object_properties(zend_object *zobj);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
@@ -234,7 +219,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
/* Default behavior for get_properties_for. For use as a fallback in custom
* get_properties_for implementations. */
-ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose purpose);
+ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose);
/* Will call get_properties_for handler or use default behavior. For use by
* consumers of the get_properties_for API. */
@@ -254,6 +239,16 @@ ZEND_API HashTable *zend_get_properties_for(zval *obj, zend_prop_purpose purpose
} \
} while (0)
+/* Fallback to default comparison implementation if the arguments aren't both objects
+ * and have the same compare() handler. You'll likely want to use this unless you
+ * explicitly wish to support comparisons between objects and non-objects. */
+#define ZEND_COMPARE_OBJECTS_FALLBACK(op1, op2) \
+ if (Z_TYPE_P(op1) != IS_OBJECT || \
+ Z_TYPE_P(op2) != IS_OBJECT || \
+ Z_OBJ_HT_P(op1)->compare != Z_OBJ_HT_P(op2)->compare) { \
+ return zend_std_compare_objects(op1, op2); \
+ }
+
END_EXTERN_C()
#endif
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index eb76887a9d..04172e31e5 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -63,7 +63,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object)
if (UNEXPECTED(Z_ISREF_P(p)) &&
(ZEND_DEBUG || ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(p)))) {
zend_property_info *prop_info = zend_get_property_info_for_slot(object, p);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZEND_REF_DEL_TYPE_SOURCE(Z_REF_P(p), prop_info);
}
}
@@ -214,7 +214,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
if (UNEXPECTED(Z_ISREF_P(dst)) &&
(ZEND_DEBUG || ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(dst)))) {
zend_property_info *prop_info = zend_get_property_info_for_slot(new_object, dst);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZEND_REF_ADD_TYPE_SOURCE(Z_REF_P(dst), prop_info);
}
}
@@ -290,14 +290,12 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
}
}
-ZEND_API zend_object *zend_objects_clone_obj(zval *zobject)
+ZEND_API zend_object *zend_objects_clone_obj(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
/* assume that create isn't overwritten, so when clone depends on the
* overwritten one then it must itself be overwritten */
- old_object = Z_OBJ_P(zobject);
new_object = zend_objects_new(old_object->ce);
/* zend_objects_clone_members() expect the properties to be initialized. */
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
index cb0015599b..91d388154d 100644
--- a/Zend/zend_objects.h
+++ b/Zend/zend_objects.h
@@ -29,7 +29,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
ZEND_API void zend_object_std_dtor(zend_object *object);
ZEND_API void zend_objects_destroy_object(zend_object *object);
-ZEND_API zend_object *zend_objects_clone_obj(zval *object);
+ZEND_API zend_object *zend_objects_clone_obj(zend_object *object);
END_EXTERN_C()
#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index b9a838e7bb..85ce701cd7 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -107,7 +107,7 @@ static inline zend_property_info *zend_get_property_info_for_slot(zend_object *o
static inline zend_property_info *zend_get_typed_property_info_for_slot(zend_object *obj, zval *slot)
{
zend_property_info *prop_info = zend_get_property_info_for_slot(obj, slot);
- if (prop_info && prop_info->type) {
+ if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
return prop_info;
}
return NULL;
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index a128f9436e..626eacd35d 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -1065,7 +1065,6 @@ ZEND_API binary_op_type get_binary_op(int opcode)
return (binary_op_type) shift_left_function;
case ZEND_SR:
return (binary_op_type) shift_right_function;
- case ZEND_PARENTHESIZED_CONCAT:
case ZEND_FAST_CONCAT:
case ZEND_CONCAT:
return (binary_op_type) concat_function;
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 7c0c569164..3a2dd76e15 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -138,18 +138,11 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {
#define convert_object_to_type(op, dst, ctype, conv_func) \
ZVAL_UNDEF(dst); \
if (Z_OBJ_HT_P(op)->cast_object) { \
- if (Z_OBJ_HT_P(op)->cast_object(op, dst, ctype) == FAILURE) { \
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \
zend_error(E_RECOVERABLE_ERROR, \
"Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\
zend_get_type_by_const(ctype)); \
} \
- } else if (Z_OBJ_HT_P(op)->get) { \
- zval *newop = Z_OBJ_HT_P(op)->get(op, dst); \
- if (Z_TYPE_P(newop) != IS_OBJECT) { \
- /* for safety - avoid loop */ \
- ZVAL_COPY_VALUE(dst, newop); \
- conv_func(dst); \
- } \
}
/* }}} */
@@ -566,7 +559,7 @@ try_again:
break;
}
case IS_ARRAY:
- zend_error(E_NOTICE, "Array to string conversion");
+ zend_error(E_WARNING, "Array to string conversion");
zval_ptr_dtor(op);
ZVAL_INTERNED_STR(op, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED));
break;
@@ -574,21 +567,11 @@ try_again:
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object) {
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_STRING) == SUCCESS) {
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) {
zval_ptr_dtor(op);
ZVAL_COPY_VALUE(op, &tmp);
return;
}
- } else if (Z_OBJ_HT_P(op)->get) {
- zval *z = Z_OBJ_HT_P(op)->get(op, &tmp);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zend_string *str = zval_get_string(z);
- zval_ptr_dtor(z);
- zval_ptr_dtor(op);
- ZVAL_STR(op, str);
- return;
- }
- zval_ptr_dtor(z);
}
if (!EG(exception)) {
zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name));
@@ -886,23 +869,15 @@ try_again:
return zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op));
}
case IS_ARRAY:
- zend_error(E_NOTICE, "Array to string conversion");
+ zend_error(E_WARNING, "Array to string conversion");
return (try && UNEXPECTED(EG(exception))) ?
NULL : ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED);
case IS_OBJECT: {
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object) {
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_STRING) == SUCCESS) {
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) {
return Z_STR(tmp);
}
- } else if (Z_OBJ_HT_P(op)->get) {
- zval *z = Z_OBJ_HT_P(op)->get(op, &tmp);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zend_string *str = try ? zval_try_get_string(z) : zval_get_string(z);
- zval_ptr_dtor(z);
- return str;
- }
- zval_ptr_dtor(z);
}
if (!EG(exception)) {
zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name));
@@ -2002,98 +1977,69 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{
}
/* }}} */
-static zend_always_inline void zend_free_obj_get_result(zval *op) /* {{{ */
-{
- ZEND_ASSERT(!Z_REFCOUNTED_P(op) || Z_REFCOUNT_P(op) != 0);
- zval_ptr_dtor(op);
-}
-/* }}} */
-
-static void ZEND_FASTCALL convert_compare_result_to_long(zval *result) /* {{{ */
+ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (Z_TYPE_P(result) == IS_DOUBLE) {
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- } else {
- convert_to_long(result);
- }
+ ZVAL_LONG(result, zend_compare(op1, op2));
+ return SUCCESS;
}
/* }}} */
-ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
+ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */
{
- int ret;
int converted = 0;
zval op1_copy, op2_copy;
- zval *op_free, tmp_free;
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
case TYPE_PAIR(IS_LONG, IS_LONG):
- ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0));
- return SUCCESS;
+ return Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0);
case TYPE_PAIR(IS_DOUBLE, IS_LONG):
- Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- return SUCCESS;
+ return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - (double)Z_LVAL_P(op2));
case TYPE_PAIR(IS_LONG, IS_DOUBLE):
- Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- return SUCCESS;
+ return ZEND_NORMALIZE_BOOL((double)Z_LVAL_P(op1) - Z_DVAL_P(op2));
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) {
- ZVAL_LONG(result, 0);
+ return 0;
} else {
- Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - Z_DVAL_P(op2));
}
- return SUCCESS;
case TYPE_PAIR(IS_ARRAY, IS_ARRAY):
- ZVAL_LONG(result, zend_compare_arrays(op1, op2));
- return SUCCESS;
+ return zend_compare_arrays(op1, op2);
case TYPE_PAIR(IS_NULL, IS_NULL):
case TYPE_PAIR(IS_NULL, IS_FALSE):
case TYPE_PAIR(IS_FALSE, IS_NULL):
case TYPE_PAIR(IS_FALSE, IS_FALSE):
case TYPE_PAIR(IS_TRUE, IS_TRUE):
- ZVAL_LONG(result, 0);
- return SUCCESS;
+ return 0;
case TYPE_PAIR(IS_NULL, IS_TRUE):
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
case TYPE_PAIR(IS_TRUE, IS_NULL):
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
case TYPE_PAIR(IS_STRING, IS_STRING):
if (Z_STR_P(op1) == Z_STR_P(op2)) {
- ZVAL_LONG(result, 0);
- return SUCCESS;
+ return 0;
}
- ZVAL_LONG(result, zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)));
- return SUCCESS;
+ return zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2));
case TYPE_PAIR(IS_NULL, IS_STRING):
- ZVAL_LONG(result, Z_STRLEN_P(op2) == 0 ? 0 : -1);
- return SUCCESS;
+ return Z_STRLEN_P(op2) == 0 ? 0 : -1;
case TYPE_PAIR(IS_STRING, IS_NULL):
- ZVAL_LONG(result, Z_STRLEN_P(op1) == 0 ? 0 : 1);
- return SUCCESS;
+ return Z_STRLEN_P(op1) == 0 ? 0 : 1;
case TYPE_PAIR(IS_OBJECT, IS_NULL):
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
case TYPE_PAIR(IS_NULL, IS_OBJECT):
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
default:
if (Z_ISREF_P(op1)) {
@@ -2104,109 +2050,41 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
continue;
}
- if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, compare)) {
- ret = Z_OBJ_HANDLER_P(op1, compare)(result, op1, op2);
- if (UNEXPECTED(Z_TYPE_P(result) != IS_LONG)) {
- convert_compare_result_to_long(result);
- }
- return ret;
- } else if (Z_TYPE_P(op2) == IS_OBJECT && Z_OBJ_HANDLER_P(op2, compare)) {
- ret = Z_OBJ_HANDLER_P(op2, compare)(result, op1, op2);
- if (UNEXPECTED(Z_TYPE_P(result) != IS_LONG)) {
- convert_compare_result_to_long(result);
- }
- return ret;
+ if (Z_TYPE_P(op1) == IS_OBJECT
+ && Z_TYPE_P(op2) == IS_OBJECT
+ && Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
+ return 0;
+ } else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ return Z_OBJ_HANDLER_P(op1, compare)(op1, op2);
+ } else if (Z_TYPE_P(op2) == IS_OBJECT) {
+ return Z_OBJ_HANDLER_P(op2, compare)(op1, op2);
}
- if (Z_TYPE_P(op1) == IS_OBJECT && Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
- /* object handles are identical, apparently this is the same object */
- ZVAL_LONG(result, 0);
- return SUCCESS;
- }
- if (Z_OBJ_HANDLER_P(op1, compare_objects) == Z_OBJ_HANDLER_P(op2, compare_objects)) {
- ZVAL_LONG(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2));
- return SUCCESS;
- }
- }
- if (Z_TYPE_P(op1) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op1)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op1)->get(op1, &rv);
- ret = compare_function(result, op_free, op2);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
- ZVAL_UNDEF(&tmp_free);
- if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2))) == FAILURE) {
- ZVAL_LONG(result, 1);
- zend_free_obj_get_result(&tmp_free);
- return SUCCESS;
- }
- ret = compare_function(result, &tmp_free, op2);
- zend_free_obj_get_result(&tmp_free);
- return ret;
- }
- }
- if (Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op2)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op2)->get(op2, &rv);
- ret = compare_function(result, op1, op_free);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
- ZVAL_UNDEF(&tmp_free);
- if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1))) == FAILURE) {
- ZVAL_LONG(result, -1);
- zend_free_obj_get_result(&tmp_free);
- return SUCCESS;
- }
- ret = compare_function(result, op1, &tmp_free);
- zend_free_obj_get_result(&tmp_free);
- return ret;
- } else if (Z_TYPE_P(op1) == IS_OBJECT) {
- ZVAL_LONG(result, 1);
- return SUCCESS;
- }
- }
if (!converted) {
if (Z_TYPE_P(op1) < IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op2) ? -1 : 0);
- return SUCCESS;
+ return zval_is_true(op2) ? -1 : 0;
} else if (Z_TYPE_P(op1) == IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op2) ? 0 : 1);
- return SUCCESS;
+ return zval_is_true(op2) ? 0 : 1;
} else if (Z_TYPE_P(op2) < IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0);
- return SUCCESS;
+ return zval_is_true(op1) ? 1 : 0;
} else if (Z_TYPE_P(op2) == IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op1) ? 0 : -1);
- return SUCCESS;
+ return zval_is_true(op1) ? 0 : -1;
} else {
- op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 1);
- op2 = zendi_convert_scalar_to_number(op2, &op2_copy, result, 1);
+ op1 = _zendi_convert_scalar_to_number(op1, &op1_copy);
+ op2 = _zendi_convert_scalar_to_number(op2, &op2_copy);
if (EG(exception)) {
- if (result != op1) {
- ZVAL_UNDEF(result);
- }
- return FAILURE;
+ return 1; /* to stop comparison of arrays */
}
converted = 1;
}
} else if (Z_TYPE_P(op1)==IS_ARRAY) {
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
} else if (Z_TYPE_P(op2)==IS_ARRAY) {
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
} else {
ZEND_ASSERT(0);
zend_throw_error(NULL, "Unsupported operand types");
- if (result != op1) {
- ZVAL_UNDEF(result);
- }
- return FAILURE;
+ return 1;
}
}
}
@@ -2271,40 +2149,28 @@ ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zv
ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) == 0));
+ ZVAL_BOOL(result, zend_compare(op1, op2) == 0);
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) != 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) != 0));
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) < 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) < 0));
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0));
return SUCCESS;
}
/* }}} */
@@ -2510,18 +2376,7 @@ try_again:
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, get)
- && Z_OBJ_HANDLER_P(op1, set)) {
- /* proxy object */
- zval rv;
- zval *val;
-
- val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv);
- Z_TRY_ADDREF_P(val);
- increment_function(val);
- Z_OBJ_HANDLER_P(op1, set)(op1, val);
- zval_ptr_dtor(val);
- } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
@@ -2577,18 +2432,7 @@ try_again:
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, get)
- && Z_OBJ_HANDLER_P(op1, set)) {
- /* proxy object */
- zval rv;
- zval *val;
-
- val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv);
- Z_TRY_ADDREF_P(val);
- decrement_function(val);
- Z_OBJ_HANDLER_P(op1, set)(op1, val);
- zval_ptr_dtor(val);
- } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
@@ -2617,23 +2461,14 @@ ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */
ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */
{
- if (Z_OBJ_HT_P(op)->cast_object) {
+ zend_object *zobj = Z_OBJ_P(op);
+
+ if (zobj->handlers->cast_object) {
zval tmp;
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL) == SUCCESS) {
+ if (zobj->handlers->cast_object(zobj, &tmp, _IS_BOOL) == SUCCESS) {
return Z_TYPE(tmp) == IS_TRUE;
}
- zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(Z_OBJ_P(op)->ce->name));
- } else if (Z_OBJ_HT_P(op)->get) {
- int result;
- zval rv;
- zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv);
-
- if (Z_TYPE_P(tmp) != IS_OBJECT) {
- /* for safety - avoid loop */
- result = i_zend_is_true(tmp);
- zval_ptr_dtor(tmp);
- return result;
- }
+ zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name));
}
return 1;
}
@@ -2979,12 +2814,7 @@ string_cmp:
static int hash_zval_compare_function(zval *z1, zval *z2) /* {{{ */
{
- zval result;
-
- if (compare_function(&result, z1, z2)==FAILURE) {
- return 1;
- }
- return Z_LVAL(result);
+ return zend_compare(z1, z2);
}
/* }}} */
@@ -3006,10 +2836,10 @@ ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2) /* {{{ */
return 0;
}
- if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
+ if (Z_OBJ_HT_P(o1)->compare == NULL) {
return 1;
} else {
- return Z_OBJ_HT_P(o1)->compare_objects(o1, o2);
+ return Z_OBJ_HT_P(o1)->compare(o1, o2);
}
}
/* }}} */
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 9307bb8854..860d71b1d5 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -148,10 +148,13 @@ static zend_always_inline const char *
zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const char *end)
{
const char *p = haystack;
- const char ne = needle[needle_len-1];
ptrdiff_t off_p;
size_t off_s;
+ if (needle_len == 0) {
+ return p;
+ }
+
if (needle_len == 1) {
return (const char *)memchr(p, *needle, (end-p));
}
@@ -164,6 +167,7 @@ zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const
}
if (EXPECTED(off_s < 1024 || needle_len < 9)) { /* glibc memchr is faster when needle is too short */
+ const char ne = needle[needle_len-1];
end -= needle_len;
while (p <= end) {
@@ -206,10 +210,13 @@ static zend_always_inline const char *
zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const char *end)
{
const char *p = end;
- const char ne = needle[needle_len-1];
ptrdiff_t off_p;
size_t off_s;
+ if (needle_len == 0) {
+ return p;
+ }
+
if (needle_len == 1) {
return (const char *)zend_memrchr(haystack, *needle, (p - haystack));
}
@@ -222,6 +229,7 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const
}
if (EXPECTED(off_s < 1024 || needle_len < 3)) {
+ const char ne = needle[needle_len-1];
p -= needle_len;
do {
@@ -388,6 +396,8 @@ again:
return result;
}
+ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2);
+
ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
@@ -500,9 +510,15 @@ ZEND_API void zend_update_current_locale(void);
#define ZVAL_OFFSETOF_TYPE \
(offsetof(zval, u1.type_info) - offsetof(zval, value))
+#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer)
+# define ZEND_USE_ASM_ARITHMETIC 1
+#else
+# define ZEND_USE_ASM_ARITHMETIC 0
+#endif
+
static zend_always_inline void fast_long_increment_function(zval *op1)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"addl $1,(%0)\n\t"
"jo %l1\n"
@@ -513,7 +529,7 @@ static zend_always_inline void fast_long_increment_function(zval *op1)
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"addq $1,(%0)\n\t"
"jo %l1\n"
@@ -524,7 +540,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto (
"ldr x5, [%0]\n\t"
"adds x5, x5, 1\n\t"
@@ -565,7 +581,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
static zend_always_inline void fast_long_decrement_function(zval *op1)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"subl $1,(%0)\n\t"
"jo %l1\n"
@@ -576,7 +592,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1)
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"subq $1,(%0)\n\t"
"jo %l1\n"
@@ -587,7 +603,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto (
"ldr x5, [%0]\n\t"
"subs x5 ,x5, 1\n\t"
@@ -628,7 +644,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"movl (%1), %%eax\n\t"
"addl (%2), %%eax\n\t"
@@ -646,7 +662,7 @@ static zend_always_inline void fast_long_add_function(zval *result, zval *op1, z
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"movq (%1), %%rax\n\t"
"addq (%2), %%rax\n\t"
@@ -664,7 +680,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto(
"ldr x5, [%1]\n\t"
"ldr x6, [%2]\n\t"
@@ -738,7 +754,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"movl (%1), %%eax\n\t"
"subl (%2), %%eax\n\t"
@@ -756,7 +772,7 @@ static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, z
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"movq (%1), %%rax\n\t"
"subq (%2), %%rax\n\t"
@@ -774,7 +790,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto(
"ldr x5, [%1]\n\t"
"ldr x6, [%2]\n\t"
@@ -836,7 +852,6 @@ static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_stri
static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
@@ -854,28 +869,23 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2)
return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
}
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline zend_bool fast_is_identical_function(zval *op1, zval *op2)
@@ -899,19 +909,7 @@ static zend_always_inline zend_bool fast_is_not_identical_function(zval *op1, zv
}
#define ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(opcode, binary_op) \
- if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
- && op1 == result \
- && UNEXPECTED(Z_OBJ_HANDLER_P(op1, get)) \
- && EXPECTED(Z_OBJ_HANDLER_P(op1, set))) { \
- int ret; \
- zval rv; \
- zval *objval = Z_OBJ_HANDLER_P(op1, get)(op1, &rv); \
- Z_TRY_ADDREF_P(objval); \
- ret = binary_op(objval, objval, op2); \
- Z_OBJ_HANDLER_P(op1, set)(op1, objval); \
- zval_ptr_dtor(objval); \
- return ret; \
- } else if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
+ if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
&& UNEXPECTED(Z_OBJ_HANDLER_P(op1, do_operation))) { \
if (EXPECTED(SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, op2))) { \
return SUCCESS; \
diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c
index 1a5eb455ad..3916902e8d 100644
--- a/Zend/zend_smart_str.c
+++ b/Zend/zend_smart_str.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_str.h b/Zend/zend_smart_str.h
index 2dab1f809a..9211e54bee 100644
--- a/Zend/zend_smart_str.h
+++ b/Zend/zend_smart_str.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_str_public.h b/Zend/zend_smart_str_public.h
index ba0b399881..eef4a7100a 100644
--- a/Zend/zend_smart_str_public.h
+++ b/Zend/zend_smart_str_public.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_string.h b/Zend/zend_smart_string.h
index 4580e43769..1f74a63218 100644
--- a/Zend/zend_smart_string.h
+++ b/Zend/zend_smart_string.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_string_public.h b/Zend/zend_smart_string_public.h
index e39d67c16e..c575d514ce 100644
--- a/Zend/zend_smart_string_public.h
+++ b/Zend/zend_smart_string_public.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index b4a0ddef95..a38c1cae8c 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -480,7 +480,6 @@ EMPTY_SWITCH_DEFAULT_CASE()
_(ZEND_STR_THIS, "this") \
_(ZEND_STR_VALUE, "value") \
_(ZEND_STR_KEY, "key") \
- _(ZEND_STR_MAGIC_AUTOLOAD, "__autoload") \
_(ZEND_STR_MAGIC_INVOKE, "__invoke") \
_(ZEND_STR_PREVIOUS, "previous") \
_(ZEND_STR_CODE, "code") \
@@ -507,6 +506,12 @@ EMPTY_SWITCH_DEFAULT_CASE()
_(ZEND_STR_ARGV, "argv") \
_(ZEND_STR_ARGC, "argc") \
_(ZEND_STR_ARRAY_CAPITALIZED, "Array") \
+ _(ZEND_STR_BOOL, "bool") \
+ _(ZEND_STR_INT, "int") \
+ _(ZEND_STR_FLOAT, "float") \
+ _(ZEND_STR_CALLABLE, "callable") \
+ _(ZEND_STR_ITERABLE, "iterable") \
+ _(ZEND_STR_VOID, "void") \
typedef enum _zend_known_string_id {
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
index 3cff54bf6c..6b69b49e15 100644
--- a/Zend/zend_ts_hash.c
+++ b/Zend/zend_ts_hash.c
@@ -264,15 +264,11 @@ ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, co
end_read(source);
}
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber)
+ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber)
{
- int retval;
-
begin_write(ht);
- retval = zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber);
+ zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber);
end_write(ht);
-
- return retval;
}
ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered)
@@ -310,15 +306,11 @@ ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht)
return retval;
}
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
+ZEND_API void zend_ts_hash_rehash(TsHashTable *ht)
{
- int retval;
-
begin_write(ht);
- retval = zend_hash_rehash(TS_HASH(ht));
+ zend_hash_rehash(TS_HASH(ht));
end_write(ht);
-
- return retval;
}
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, size_t len)
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
index 35a4250d34..88aa4d45f4 100644
--- a/Zend/zend_ts_hash.h
+++ b/Zend/zend_ts_hash.h
@@ -73,13 +73,13 @@ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_c
ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);
ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite);
ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
+ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered);
ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag);
ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
+ZEND_API void zend_ts_hash_rehash(TsHashTable *ht);
#if ZEND_DEBUG
/* debug */
diff --git a/Zend/zend_type_info.h b/Zend/zend_type_info.h
index 72550b6fc3..9479d5aad2 100644
--- a/Zend/zend_type_info.h
+++ b/Zend/zend_type_info.h
@@ -34,7 +34,12 @@
#define MAY_BE_ANY (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)
#define MAY_BE_REF (1 << IS_REFERENCE) /* may be reference */
-#define MAY_BE_ARRAY_SHIFT (IS_REFERENCE)
+/* These are used in zend_type, but not for type inference. */
+#define MAY_BE_CALLABLE (1 << IS_CALLABLE)
+#define MAY_BE_ITERABLE (1 << IS_ITERABLE)
+#define MAY_BE_VOID (1 << IS_VOID)
+
+#define MAY_BE_ARRAY_SHIFT (IS_VOID)
#define MAY_BE_ARRAY_OF_NULL (MAY_BE_NULL << MAY_BE_ARRAY_SHIFT)
#define MAY_BE_ARRAY_OF_FALSE (MAY_BE_FALSE << MAY_BE_ARRAY_SHIFT)
@@ -48,11 +53,11 @@
#define MAY_BE_ARRAY_OF_ANY (MAY_BE_ANY << MAY_BE_ARRAY_SHIFT)
#define MAY_BE_ARRAY_OF_REF (MAY_BE_REF << MAY_BE_ARRAY_SHIFT)
-#define MAY_BE_ARRAY_KEY_LONG (1<<21)
-#define MAY_BE_ARRAY_KEY_STRING (1<<22)
+#define MAY_BE_ARRAY_KEY_LONG (1<<25)
+#define MAY_BE_ARRAY_KEY_STRING (1<<26)
#define MAY_BE_ARRAY_KEY_ANY (MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_KEY_STRING)
-#define MAY_BE_ERROR (1<<23)
-#define MAY_BE_CLASS (1<<24)
+/* Bit 27 unused */
+#define MAY_BE_CLASS (1<<28)
#endif /* ZEND_TYPE_INFO_H */
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 83877e0d5d..8d2726a14c 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -15,7 +15,7 @@
| Authors: Andi Gutmans <andi@php.net> |
| Zeev Suraski <zeev@php.net> |
| Dmitry Stogov <dmitry@php.net> |
- | Xinchen Hui <xinchen.h@zend.com> |
+ | Xinchen Hui <laruence@php.net> |
+----------------------------------------------------------------------+
*/
@@ -106,61 +106,76 @@ typedef void (*copy_ctor_func_t)(zval *pElement);
* It shouldn't be used directly. Only through ZEND_TYPE_* macros.
*
* ZEND_TYPE_IS_SET() - checks if type-hint exists
- * ZEND_TYPE_IS_CODE() - checks if type-hint refer to standard type
+ * ZEND_TYPE_IS_MASK() - checks if type-hint refer to standard type
* ZEND_TYPE_IS_CLASS() - checks if type-hint refer to some class
* ZEND_TYPE_IS_CE() - checks if type-hint refer to some class by zend_class_entry *
* ZEND_TYPE_IS_NAME() - checks if type-hint refer to some class by zend_string *
*
* ZEND_TYPE_NAME() - returns referenced class name
* ZEND_TYPE_CE() - returns referenced class entry
- * ZEND_TYPE_CODE() - returns standard type code (e.g. IS_LONG, _IS_BOOL)
+ * ZEND_TYPE_MASK() - returns MAY_BE_* type mask
*
* ZEND_TYPE_ALLOW_NULL() - checks if NULL is allowed
*
- * ZEND_TYPE_ENCODE() and ZEND_TYPE_ENCODE_CLASS() should be used for
- * construction.
+ * ZEND_TYPE_ENCODE_*() should be used for construction.
*/
typedef uintptr_t zend_type;
+#define _ZEND_TYPE_CODE_MAX ((Z_L(1)<<(IS_VOID+1))-1)
+#define _ZEND_TYPE_FLAG_MASK Z_L(0x3)
+#define _ZEND_TYPE_CE_BIT Z_L(0x1)
+/* Must have same value as MAY_BE_NULL */
+#define _ZEND_TYPE_NULLABLE_BIT Z_L(0x2)
+
#define ZEND_TYPE_IS_SET(t) \
- ((t) > Z_L(0x3))
+ ((t) != 0)
-#define ZEND_TYPE_IS_CODE(t) \
- (((t) > Z_L(0x3)) && ((t) <= Z_L(0x3ff)))
+#define ZEND_TYPE_IS_MASK(t) \
+ ((t) != 0 && (t) <= _ZEND_TYPE_CODE_MAX)
#define ZEND_TYPE_IS_CLASS(t) \
- ((t) > Z_L(0x3ff))
+ ((t) > _ZEND_TYPE_CODE_MAX)
#define ZEND_TYPE_IS_CE(t) \
- (((t) & Z_L(0x2)) != 0)
+ (((t) & _ZEND_TYPE_CE_BIT) != 0)
#define ZEND_TYPE_IS_NAME(t) \
(ZEND_TYPE_IS_CLASS(t) && !ZEND_TYPE_IS_CE(t))
#define ZEND_TYPE_NAME(t) \
- ((zend_string*)((t) & ~Z_L(0x3)))
+ ((zend_string*)((t) & ~_ZEND_TYPE_FLAG_MASK))
#define ZEND_TYPE_CE(t) \
- ((zend_class_entry*)((t) & ~Z_L(0x3)))
+ ((zend_class_entry*)((t) & ~_ZEND_TYPE_FLAG_MASK))
+
+#define ZEND_TYPE_MASK(t) \
+ (t)
-#define ZEND_TYPE_CODE(t) \
- ((t) >> Z_L(2))
+#define ZEND_TYPE_CONTAINS_CODE(t, code) \
+ (((t) & (1 << (code))) != 0)
#define ZEND_TYPE_ALLOW_NULL(t) \
- (((t) & Z_L(0x1)) != 0)
+ (((t) & _ZEND_TYPE_NULLABLE_BIT) != 0)
#define ZEND_TYPE_WITHOUT_NULL(t) \
- ((t) & ~Z_L(0x1))
+ ((t) & ~_ZEND_TYPE_NULLABLE_BIT)
+
+#define ZEND_TYPE_ENCODE_NONE() \
+ (0)
-#define ZEND_TYPE_ENCODE(code, allow_null) \
- (((code) << Z_L(2)) | ((allow_null) ? Z_L(0x1) : Z_L(0x0)))
+#define ZEND_TYPE_ENCODE_MASK(maybe_code) \
+ (maybe_code)
+
+#define ZEND_TYPE_ENCODE_CODE(code, allow_null) \
+ (((code) == _IS_BOOL ? (MAY_BE_FALSE|MAY_BE_TRUE) : (1 << (code))) \
+ | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : Z_L(0x0)))
#define ZEND_TYPE_ENCODE_CE(ce, allow_null) \
- (((uintptr_t)(ce)) | ((allow_null) ? Z_L(0x3) : Z_L(0x2)))
+ (((uintptr_t)(ce)) | _ZEND_TYPE_CE_BIT | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : Z_L(0x0)))
#define ZEND_TYPE_ENCODE_CLASS(class_name, allow_null) \
- (((uintptr_t)(class_name)) | ((allow_null) ? Z_L(0x1) : Z_L(0x0)))
+ (((uintptr_t)(class_name)) | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : Z_L(0x0)))
#define ZEND_TYPE_ENCODE_CLASS_CONST_0(class_name) \
((zend_type) class_name)
@@ -410,7 +425,7 @@ struct _zend_ast_ref {
/*zend_ast ast; zend_ast follows the zend_ast_ref structure */
};
-/* regular data types */
+/* Regular data types: Must be in sync with zend_variables.c. */
#define IS_UNDEF 0
#define IS_NULL 1
#define IS_FALSE 2
@@ -422,21 +437,21 @@ struct _zend_ast_ref {
#define IS_OBJECT 8
#define IS_RESOURCE 9
#define IS_REFERENCE 10
+#define IS_CONSTANT_AST 11 /* Constant expressions */
-/* constant expressions */
-#define IS_CONSTANT_AST 11
+/* Fake types used only for type hinting. IS_VOID should be the last. */
+#define IS_CALLABLE 12
+#define IS_ITERABLE 13
+#define IS_VOID 14
/* internal types */
-#define IS_INDIRECT 13
-#define IS_PTR 14
-#define _IS_ERROR 15
+#define IS_INDIRECT 15
+#define IS_PTR 16
+#define _IS_ERROR 17
-/* fake types used only for type hinting (Z_TYPE(zv) can not use them) */
-#define _IS_BOOL 16
-#define IS_CALLABLE 17
-#define IS_ITERABLE 18
-#define IS_VOID 19
-#define _IS_NUMBER 20
+/* used for casts */
+#define _IS_BOOL 18
+#define _IS_NUMBER 19
static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;
@@ -714,7 +729,7 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#define Z_OBJCE(zval) (Z_OBJ(zval)->ce)
#define Z_OBJCE_P(zval_p) Z_OBJCE(*(zval_p))
-#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval))
+#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(Z_OBJ(zval))
#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*(zval_p))
#define Z_RES(zval) (zval).value.res
@@ -776,17 +791,17 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
(b) ? IS_TRUE : IS_FALSE; \
} while (0)
-#define ZVAL_LONG(z, l) { \
+#define ZVAL_LONG(z, l) do { \
zval *__z = (z); \
Z_LVAL_P(__z) = l; \
Z_TYPE_INFO_P(__z) = IS_LONG; \
- }
+ } while (0)
-#define ZVAL_DOUBLE(z, d) { \
+#define ZVAL_DOUBLE(z, d) do { \
zval *__z = (z); \
Z_DVAL_P(__z) = d; \
Z_TYPE_INFO_P(__z) = IS_DOUBLE; \
- }
+ } while (0)
#define ZVAL_STR(z, s) do { \
zval *__z = (z); \
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 177c66ed7f..2e012237b3 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h
index 574bee992b..84a1562c77 100644
--- a/Zend/zend_virtual_cwd.h
+++ b/Zend/zend_virtual_cwd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 287466df4b..6d14873360 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -47,7 +47,6 @@ ZEND_VM_HELPER(zend_add_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_HOT_NOCONSTCONST_HANDLER(1, ZEND_ADD, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -107,7 +106,6 @@ ZEND_VM_HELPER(zend_sub_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_HOT_NOCONSTCONST_HANDLER(2, ZEND_SUB, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -167,7 +165,6 @@ ZEND_VM_HELPER(zend_mul_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(3, ZEND_MUL, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -209,7 +206,6 @@ ZEND_VM_C_LABEL(mul_double):
ZEND_VM_COLD_CONSTCONST_HANDLER(4, ZEND_DIV, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -255,7 +251,6 @@ ZEND_VM_HELPER(zend_mod_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(5, ZEND_MOD, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -304,7 +299,6 @@ ZEND_VM_HELPER(zend_shift_left_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(6, ZEND_SL, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -347,7 +341,6 @@ ZEND_VM_HELPER(zend_shift_right_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(7, ZEND_SR, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -367,7 +360,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(7, ZEND_SR, CONST|TMPVARCV, CONST|TMPVARCV)
ZEND_VM_COLD_CONSTCONST_HANDLER(12, ZEND_POW, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -382,7 +374,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(12, ZEND_POW, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(NO_CONST_CONST))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -454,7 +445,6 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(NO_CONST_
ZEND_VM_COLD_CONSTCONST_HANDLER(16, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
@@ -465,14 +455,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(16, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|T
FREE_OP1();
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONSTCONST_HANDLER(17, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
@@ -483,12 +470,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(17, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CON
FREE_OP1();
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HELPER(zend_is_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -498,31 +484,19 @@ ZEND_VM_HELPER(zend_is_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
ZEND_VM_COLD_CONSTCONST_HANDLER(18, ZEND_IS_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(SMART_BRANCH,COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -535,13 +509,9 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(18, ZEND_IS_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_equal_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_equal_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -584,6 +554,7 @@ ZEND_VM_C_LABEL(is_equal_double):
ZEND_VM_HELPER(zend_is_not_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -593,31 +564,19 @@ ZEND_VM_HELPER(zend_is_not_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) != 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret != 0, 1);
}
ZEND_VM_COLD_CONSTCONST_HANDLER(19, ZEND_IS_NOT_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(SMART_BRANCH,COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -630,13 +589,9 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(19, ZEND_IS_NOT_EQUAL, CONST|TMPVAR|CV, CONST|TM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_not_equal_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_not_equal_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -679,6 +634,7 @@ ZEND_VM_C_LABEL(is_not_equal_double):
ZEND_VM_HELPER(zend_is_smaller_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -688,31 +644,19 @@ ZEND_VM_HELPER(zend_is_smaller_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) < 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret < 0, 1);
}
ZEND_VM_HOT_NOCONSTCONST_HANDLER(20, ZEND_IS_SMALLER, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -725,13 +669,9 @@ ZEND_VM_HOT_NOCONSTCONST_HANDLER(20, ZEND_IS_SMALLER, CONST|TMPVARCV, CONST|TMPV
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_smaller_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_smaller_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -759,6 +699,7 @@ ZEND_VM_C_LABEL(is_smaller_double):
ZEND_VM_HELPER(zend_is_smaller_or_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -768,31 +709,19 @@ ZEND_VM_HELPER(zend_is_smaller_or_equal_helper, ANY, ANY, zval *op_1, zval *op_2
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) <= 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret <= 0, 1);
}
ZEND_VM_HOT_NOCONSTCONST_HANDLER(21, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -840,7 +769,6 @@ ZEND_VM_C_LABEL(is_smaller_or_equal_double):
ZEND_VM_COLD_CONSTCONST_HANDLER(170, ZEND_SPACESHIP, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -876,7 +804,6 @@ ZEND_VM_HELPER(zend_bw_or_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(9, ZEND_BW_OR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -916,7 +843,6 @@ ZEND_VM_HELPER(zend_bw_and_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(10, ZEND_BW_AND, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -956,7 +882,6 @@ ZEND_VM_HELPER(zend_bw_xor_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(11, ZEND_BW_XOR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -975,7 +900,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(11, ZEND_BW_XOR, CONST|TMPVARCV, CONST|TMPVARCV,
ZEND_VM_COLD_CONSTCONST_HANDLER(15, ZEND_BOOL_XOR, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -990,7 +914,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(15, ZEND_BOOL_XOR, CONST|TMPVAR|CV, CONST|TMPVAR
ZEND_VM_COLD_CONST_HANDLER(13, ZEND_BW_NOT, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -1012,7 +935,6 @@ ZEND_VM_COLD_CONST_HANDLER(14, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
@@ -1061,13 +983,14 @@ ZEND_VM_COLD_HELPER(zend_undefined_function_helper, ANY, ANY)
ZEND_VM_HANDLER(28, ZEND_ASSIGN_OBJ_OP, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1090,16 +1013,24 @@ ZEND_VM_HANDLER(28, ZEND_ASSIGN_OBJ_OP, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, OP)
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(assign_op_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -1136,7 +1067,10 @@ ZEND_VM_C_LABEL(assign_op_object):
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1153,7 +1087,6 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
/* This helper actually never will receive IS_VAR as second op, and has the same handling for VAR and TMP in the first op, but for interoperability with the other binary_assign_op helpers, it is necessary to "include" it */
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
zend_reference *ref;
@@ -1179,7 +1112,7 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
prop = Z_REFVAL_P(prop);
}
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
/* special case for typed properties */
zend_binary_assign_op_typed_prop(prop_info, prop, value OPLINE_CC EXECUTE_DATA_CC);
} else {
@@ -1199,7 +1132,6 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
ZEND_VM_HANDLER(27, ZEND_ASSIGN_DIM_OP, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -1228,7 +1160,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array):
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (OP2_TYPE != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -1245,7 +1177,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array):
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -1284,7 +1216,6 @@ ZEND_VM_C_LABEL(assign_dim_op_ret_null):
ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *var_ptr;
zval *value;
@@ -1292,26 +1223,20 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
FREE_OP2();
@@ -1322,12 +1247,13 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1348,16 +1274,24 @@ ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(pre_incdec_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -1371,7 +1305,10 @@ ZEND_VM_C_LABEL(pre_incdec_object):
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1388,12 +1325,13 @@ ZEND_VM_HANDLER(133, ZEND_PRE_DEC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1414,16 +1352,24 @@ ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CAC
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(post_incdec_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -1436,7 +1382,10 @@ ZEND_VM_C_LABEL(post_incdec_object):
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1464,7 +1413,8 @@ ZEND_VM_HANDLER(38, ZEND_PRE_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
HANDLE_EXCEPTION();
}
- zend_pre_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -1489,7 +1439,8 @@ ZEND_VM_HANDLER(40, ZEND_POST_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
HANDLE_EXCEPTION();
}
- zend_post_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -1503,18 +1454,10 @@ ZEND_VM_HANDLER(41, ZEND_POST_DEC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
ZEND_VM_HELPER(zend_pre_inc_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1544,7 +1487,6 @@ ZEND_VM_HELPER(zend_pre_inc_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1563,18 +1505,10 @@ ZEND_VM_HOT_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY, SPEC(RETVAL))
ZEND_VM_HELPER(zend_pre_dec_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1605,7 +1539,6 @@ ZEND_VM_HELPER(zend_pre_dec_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1624,16 +1557,10 @@ ZEND_VM_HOT_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY, SPEC(RETVAL))
ZEND_VM_HELPER(zend_post_inc_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1662,7 +1589,6 @@ ZEND_VM_HELPER(zend_post_inc_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1679,16 +1605,10 @@ ZEND_VM_HOT_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
ZEND_VM_HELPER(zend_post_dec_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1717,7 +1637,6 @@ ZEND_VM_HELPER(zend_post_dec_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1734,7 +1653,6 @@ ZEND_VM_HOT_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
ZEND_VM_HANDLER(136, ZEND_ECHO, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *z;
SAVE_OPLINE();
@@ -1764,7 +1682,6 @@ ZEND_VM_HANDLER(136, ZEND_ECHO, CONST|TMPVAR|CV, ANY)
ZEND_VM_HELPER(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED, int type)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -1806,7 +1723,7 @@ ZEND_VM_C_LABEL(fetch_this):
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -1825,7 +1742,7 @@ ZEND_VM_C_LABEL(fetch_this):
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -1913,7 +1830,7 @@ ZEND_VM_HANDLER(173, ZEND_FETCH_STATIC_PROP_R, ANY, CLASS_FETCH, CACHE_SLOT)
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
-ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
+ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_static_prop_helper, type, BP_VAR_W);
}
@@ -1948,7 +1865,6 @@ ZEND_VM_HANDLER(176, ZEND_FETCH_STATIC_PROP_IS, ANY, CLASS_FETCH, CACHE_SLOT)
ZEND_VM_COLD_CONSTCONST_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -1984,7 +1900,6 @@ ZEND_VM_C_LABEL(fetch_dim_r_slow):
ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -1992,8 +1907,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
zend_fetch_dimension_address_W(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2001,7 +1915,6 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2009,8 +1922,7 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
zend_fetch_dimension_address_RW(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2018,7 +1930,6 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
ZEND_VM_COLD_CONSTCONST_HANDLER(90, ZEND_FETCH_DIM_IS, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2075,7 +1986,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, C
ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2083,8 +1993,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
zend_fetch_dimension_address_UNSET(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2092,9 +2001,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
ZEND_VM_HOT_OBJ_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -2131,9 +2038,11 @@ ZEND_VM_HOT_OBJ_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMPVAR|UNUSED|THIS|CV, CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -2158,10 +2067,10 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (!ZEND_VM_SPEC || (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) != 0) {
ZEND_VM_C_GOTO(fetch_obj_r_copy);
@@ -2172,7 +2081,7 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -2184,11 +2093,22 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
}
}
}
- } else if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
ZEND_VM_C_LABEL(fetch_obj_r_copy):
@@ -2204,10 +2124,9 @@ ZEND_VM_C_LABEL(fetch_obj_r_finish):
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
+ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -2225,7 +2144,7 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2233,7 +2152,6 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH
ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -2247,7 +2165,7 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
zend_fetch_property_address(result, container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2255,9 +2173,7 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
ZEND_VM_COLD_CONST_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -2287,9 +2203,11 @@ ZEND_VM_COLD_CONST_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, C
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -2314,10 +2232,10 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (!ZEND_VM_SPEC || (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) != 0) {
ZEND_VM_C_GOTO(fetch_obj_is_copy);
@@ -2328,7 +2246,7 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -2340,9 +2258,19 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
ZEND_VM_C_LABEL(fetch_obj_is_copy):
@@ -2378,7 +2306,6 @@ ZEND_VM_COLD_CONST_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THI
ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -2393,7 +2320,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, C
zend_fetch_property_address(result, container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2401,7 +2328,6 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, C
ZEND_VM_HANDLER(98, ZEND_FETCH_LIST_R, CONST|TMPVARCV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2414,7 +2340,6 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_LIST_R, CONST|TMPVARCV, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(155, ZEND_FETCH_LIST_W, VAR, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim;
SAVE_OPLINE();
@@ -2438,8 +2363,9 @@ ZEND_VM_HANDLER(155, ZEND_FETCH_LIST_W, VAR, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(24, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
@@ -2456,16 +2382,15 @@ ZEND_VM_HANDLER(24, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_
object = Z_REFVAL_P(object);
ZEND_VM_C_GOTO(assign_object);
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- ZEND_VM_C_GOTO(free_and_exit_assign_obj);
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ ZEND_VM_C_GOTO(free_and_exit_assign_obj);
}
ZEND_VM_C_LABEL(assign_object):
+ zobj = Z_OBJ_P(object);
if (OP2_TYPE == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -2549,7 +2474,22 @@ ZEND_VM_C_LABEL(fast_assign_obj):
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP_DATA();
+ UNDEF_RESULT();
+ ZEND_VM_C_GOTO(exit_assign_obj);
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
ZEND_VM_C_LABEL(free_and_exit_assign_obj):
FREE_OP_DATA();
@@ -2567,7 +2507,6 @@ ZEND_VM_C_LABEL(exit_assign_obj):
ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -2581,7 +2520,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=
value = GET_OP_DATA_ZVAL_PTR(BP_VAR_R);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
FREE_OP_DATA();
} else {
@@ -2599,9 +2538,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=
ZEND_VM_HANDLER(23, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -2627,11 +2564,12 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
Z_ADDREF_P(value);
}
} else if (OP_DATA_TYPE == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
- FREE_OP_DATA();
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (OP_DATA_TYPE == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -2694,9 +2632,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
ZEND_VM_C_GOTO(try_assign_dim_array);
}
} else {
- if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
ZEND_VM_C_LABEL(assign_dim_error):
FREE_UNFETCHED_OP_DATA();
@@ -2716,7 +2652,6 @@ ZEND_VM_C_LABEL(assign_dim_error):
ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
@@ -2724,19 +2659,12 @@ ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- FREE_OP2();
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, OP2_TYPE, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- FREE_OP1_VAR_PTR();
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, OP2_TYPE, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ FREE_OP1_VAR_PTR();
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2744,7 +2672,6 @@ ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *variable_ptr;
zval *value_ptr;
@@ -2752,15 +2679,11 @@ ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
value_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W);
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (OP1_TYPE == IS_VAR &&
+ if (OP1_TYPE == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (OP2_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (OP2_TYPE == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -2784,7 +2707,6 @@ ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
ZEND_VM_HANDLER(32, ZEND_ASSIGN_OBJ_REF, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT|SRC, SPEC(OP_DATA=VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -2827,7 +2749,6 @@ ZEND_VM_HANDLER(32, ZEND_ASSIGN_OBJ_REF, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CA
ZEND_VM_HANDLER(33, ZEND_ASSIGN_STATIC_PROP_REF, ANY, ANY, CACHE_SLOT|SRC)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value_ptr;
zend_property_info *prop_info;
@@ -2841,13 +2762,11 @@ ZEND_VM_HANDLER(33, ZEND_ASSIGN_STATIC_PROP_REF, ANY, ANY, CACHE_SLOT|SRC)
value_ptr = GET_OP_DATA_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP_DATA_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- prop = &EG(uninitialized_zval);
- } else if (OP_DATA_TYPE == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
+ if (OP_DATA_TYPE == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
if (UNEXPECTED(!zend_wrong_assign_to_variable_reference(prop, value_ptr OPLINE_CC EXECUTE_DATA_CC))) {
prop = &EG(uninitialized_zval);
}
- } else if (UNEXPECTED(prop_info->type)) {
+ } else if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
prop = zend_assign_to_typed_property_reference(prop_info, prop, value_ptr EXECUTE_DATA_CC);
} else {
zend_assign_to_variable_reference(prop, value_ptr);
@@ -2986,8 +2905,8 @@ ZEND_VM_HOT_HANDLER(42, ZEND_JMP, JMP_ADDR, ANY)
ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3005,20 +2924,23 @@ ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3036,20 +2958,23 @@ ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, JMP_ADDR, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3068,19 +2993,21 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, JMP_ADDR, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
@@ -3117,7 +3044,6 @@ ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
@@ -3176,7 +3102,6 @@ ZEND_VM_HOT_HANDLER(127, ZEND_FE_FREE, TMPVAR, ANY)
ZEND_VM_COLD_CONSTCONST_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -3297,7 +3222,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMP
ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
@@ -3333,7 +3257,6 @@ ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
@@ -3369,7 +3292,6 @@ ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -3425,7 +3347,6 @@ ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, UNUSED|CLASS_FETCH, CONST|TMPVAR|UNUSED|CV, CACHE_SLOT)
{
- zend_free_op free_op2;
zval *class_name;
USE_OPLINE
@@ -3471,7 +3392,6 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -3566,7 +3486,6 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
HANDLE_EXCEPTION();
}
if (OP2_TYPE == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -3597,9 +3516,12 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
} else if (OP1_TYPE & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (OP1_TYPE == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- FREE_OP1();
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -3658,8 +3580,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
-
function_name = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP2_TYPE != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -3695,7 +3615,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
HANDLE_EXCEPTION();
}
if (OP2_TYPE == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -3726,13 +3645,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- ZEND_VM_C_GOTO(check_parent_and_self);
+ HANDLE_EXCEPTION();
}
} else {
-ZEND_VM_C_LABEL(check_parent_and_self):
/* previous opcode is ZEND_FETCH_CLASS */
if (OP1_TYPE == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -3785,7 +3700,6 @@ ZEND_VM_HOT_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
ZEND_VM_HANDLER(128, ZEND_INIT_DYNAMIC_CALL, ANY, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_execute_data *call;
@@ -3796,7 +3710,7 @@ ZEND_VM_C_LABEL(try_function_name):
if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((OP2_TYPE & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3842,7 +3756,6 @@ ZEND_VM_C_LABEL(try_function_name):
ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -3854,16 +3767,8 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
SAVE_OPLINE();
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
- FREE_OP2();
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -3896,14 +3801,10 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
FREE_OP2();
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -3992,6 +3893,10 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -3999,6 +3904,9 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4087,15 +3995,9 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL))
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!RETURN_VALUE_USED(opline)) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(fcall_by_name_end);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -4104,6 +4006,9 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL))
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4136,27 +4041,9 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-ZEND_VM_C_LABEL(fcall_except):
- UNDEF_RESULT();
- if (!RETURN_VALUE_USED(opline)) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(fcall_end);
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- ZEND_VM_C_GOTO(fcall_except);
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -4178,14 +4065,28 @@ ZEND_VM_C_LABEL(fcall_except):
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!RETURN_VALUE_USED(opline)) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ ZEND_VM_C_GOTO(fcall_end);
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- ZEND_VM_C_GOTO(fcall_except);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -4199,6 +4100,9 @@ ZEND_VM_C_LABEL(fcall_except):
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4213,19 +4117,6 @@ ZEND_VM_C_LABEL(fcall_end):
if (!RETURN_VALUE_USED(opline)) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -4253,7 +4144,6 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
/* prevents "undefined variable opline" errors */
#if !ZEND_VM_SPEC || (OP1_TYPE != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
retval_ref = retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -4271,9 +4161,8 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -4297,7 +4186,6 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
return_value = EX(return_value);
@@ -4309,9 +4197,9 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
}
} else if (!return_value) {
if (OP1_TYPE & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -4365,7 +4253,6 @@ ZEND_VM_COLD_CONST_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY, SRC)
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -4502,7 +4389,6 @@ ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
@@ -4542,11 +4428,10 @@ ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, CONST|TMP|VAR|CV, ANY)
ZEND_VM_RETURN();
}
-ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -4572,13 +4457,10 @@ ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
} while (0);
zend_exception_save();
- if (OP1_TYPE != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
- FREE_OP1_IF_VAR();
+ FREE_OP1();
HANDLE_EXCEPTION();
}
@@ -4639,7 +4521,6 @@ ZEND_VM_HOT_HANDLER(65, ZEND_SEND_VAL, CONST|TMPVAR, NUM)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -4670,7 +4551,6 @@ ZEND_VM_HOT_SEND_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
@@ -4696,7 +4576,6 @@ ZEND_VM_HOT_HANDLER(117, ZEND_SEND_VAR, VAR|CV, NUM)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
@@ -4733,7 +4612,6 @@ ZEND_VM_HOT_HANDLER(117, ZEND_SEND_VAR, VAR|CV, NUM)
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -4753,7 +4631,6 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, NUM)
ZEND_VM_HOT_SEND_HANDLER(50, ZEND_SEND_VAR_NO_REF_EX, VAR, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -4794,19 +4671,12 @@ ZEND_VM_HOT_SEND_HANDLER(50, ZEND_SEND_VAR_NO_REF_EX, VAR, NUM, SPEC(QUICK_ARG))
ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
SAVE_OPLINE();
varptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -4822,7 +4692,6 @@ ZEND_VM_HOT_SEND_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
@@ -4889,7 +4758,6 @@ ZEND_VM_HOT_HANDLER(185, ZEND_SEND_FUNC_ARG, VAR, NUM)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
if (UNEXPECTED(ZEND_CALL_INFO(EX(call)) & ZEND_CALL_SEND_ARG_BY_REF)) {
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF);
@@ -4918,7 +4786,6 @@ ZEND_VM_HOT_HANDLER(185, ZEND_SEND_FUNC_ARG, VAR, NUM)
ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
int arg_num;
@@ -4984,7 +4851,7 @@ ZEND_VM_C_LABEL(send_again):
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, args, 0);
@@ -5061,7 +4928,7 @@ ZEND_VM_C_LABEL(send_again):
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(args) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
}
FREE_OP1();
@@ -5071,7 +4938,6 @@ ZEND_VM_C_LABEL(send_again):
ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
SAVE_OPLINE();
@@ -5084,16 +4950,10 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
ZEND_VM_C_GOTO(send_array);
}
}
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
- if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(call)->func));
- } else if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_RELEASE_THIS) {
- OBJ_RELEASE(Z_OBJ(EX(call)->This));
- }
- EX(call)->func = (zend_function*)&zend_pass_function;
- Z_OBJ(EX(call)->This) = NULL;
- ZEND_CALL_INFO(EX(call)) &= ~(ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS);
+ zend_type_error("call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
FREE_UNFETCHED_OP2();
+ FREE_OP1();
+ HANDLE_EXCEPTION();
} else {
uint32_t arg_num;
HashTable *ht;
@@ -5103,7 +4963,6 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
ZEND_VM_C_LABEL(send_array):
ht = Z_ARRVAL_P(args);
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *op2 = GET_OP2_ZVAL_PTR(BP_VAR_R);
uint32_t skip = opline->extended_value;
uint32_t count = zend_hash_num_elements(ht);
@@ -5182,7 +5041,6 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -5197,7 +5055,7 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED|CACHE_SLOT)
+ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
@@ -5210,7 +5068,7 @@ ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED|CACHE_SLOT)
zval *param = EX_VAR(opline->result.var);
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -5256,10 +5114,8 @@ ZEND_VM_HOT_HANDLER(64, ZEND_RECV_INIT, NUM, CONST, CACHE_SLOT)
} else {
ZEND_VM_C_LABEL(recv_init_check_type):
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
- zval *default_value = RT_CONSTANT(opline, opline->op2);
-
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(opline->extended_value)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -5269,7 +5125,7 @@ ZEND_VM_C_LABEL(recv_init_check_type):
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
+ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
@@ -5289,7 +5145,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
- zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
+ zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;
@@ -5313,7 +5169,6 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
@@ -5336,6 +5191,7 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
ZEND_VM_HELPER(zend_case_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -5345,28 +5201,16 @@ ZEND_VM_HELPER(zend_case_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
ZEND_VM_HANDLER(48, ZEND_CASE, TMPVAR, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -5377,13 +5221,9 @@ ZEND_VM_HANDLER(48, ZEND_CASE, TMPVAR, CONST|TMPVAR|CV)
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(case_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(case_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5493,8 +5333,8 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -5528,9 +5368,10 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
FREE_OP1();
@@ -5551,7 +5392,7 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -5647,7 +5488,6 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, REF)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -5686,7 +5526,6 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSE
}
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
zend_string *str;
zend_ulong hval;
@@ -5745,7 +5584,6 @@ ZEND_VM_C_LABEL(num_index):
ZEND_VM_HANDLER(147, ZEND_ADD_ARRAY_UNPACK, ANY, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
@@ -5779,7 +5617,7 @@ ZEND_VM_C_LABEL(add_unpack_again):
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, op1, 0);
if (UNEXPECTED(!iter)) {
@@ -5873,7 +5711,6 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|CV|UNUSED, CONST|TMPVAR|UNUSE
ZEND_VM_COLD_CONST_HANDLER(51, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -5969,7 +5806,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY, EVAL)
{
USE_OPLINE
zend_op_array *new_op_array;
- zend_free_op free_op1;
zval *inc_filename;
SAVE_OPLINE();
@@ -6059,7 +5895,6 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -6098,7 +5933,6 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
zval *varname;
zend_string *name, *tmp_name = NULL;
zend_class_entry *ce;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -6133,7 +5967,11 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
varname = ZVAL_UNDEFINED_OP1();
}
- name = zval_get_tmp_string(varname, &tmp_name);
+ name = zval_try_get_tmp_string(varname, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP1();
+ HANDLE_EXCEPTION();
+ }
}
zend_std_unset_static_property(ce, name);
@@ -6146,7 +5984,6 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
zend_ulong hval;
@@ -6204,7 +6041,7 @@ ZEND_VM_C_LABEL(num_index_dim):
key = ZSTR_EMPTY_ALLOC();
ZEND_VM_C_GOTO(str_index_dim);
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -6223,7 +6060,7 @@ ZEND_VM_C_LABEL(num_index_dim):
if (OP2_TYPE == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -6237,9 +6074,9 @@ ZEND_VM_C_LABEL(num_index_dim):
ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_UNSET);
@@ -6263,7 +6100,18 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_S
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
FREE_OP2();
@@ -6274,7 +6122,6 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_S
ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -6291,20 +6138,27 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (OP1_TYPE != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -6332,7 +6186,6 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -6765,25 +6618,15 @@ ZEND_VM_HOT_HANDLER(154, ZEND_ISSET_ISEMPTY_CV, CV, UNUSED, ISSET, SPEC(ISSET))
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -6792,7 +6635,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|
USE_OPLINE
zval *value;
int result;
- zend_free_op free_op1;
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -6830,8 +6672,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
@@ -6853,14 +6693,11 @@ ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, ANY, CLASS_FETCH, ISSET|CAC
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONSTCONST_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|CV, CONST|TMPVAR|CV, ISSET)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -6895,6 +6732,10 @@ ZEND_VM_C_LABEL(num_index_prop):
ZEND_VM_C_GOTO(isset_again);
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ ZEND_VM_C_GOTO(isset_dim_obj_exit);
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -6906,8 +6747,6 @@ ZEND_VM_C_LABEL(num_index_prop):
/* avoid exception check */
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -6933,17 +6772,15 @@ ZEND_VM_C_LABEL(isset_dim_obj_exit):
FREE_OP2();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONST_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, ISSET|CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
@@ -6968,23 +6805,34 @@ ZEND_VM_COLD_CONST_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED
}
}
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ ZEND_VM_C_GOTO(isset_object_finish);
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
ZEND_VM_C_LABEL(isset_object_finish):
FREE_OP2();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(194, ZEND_ARRAY_KEY_EXISTS, CV|TMPVAR|CONST, CV|TMPVAR|CONST)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -7011,8 +6859,6 @@ ZEND_VM_C_LABEL(array_key_exists_array):
FREE_OP2();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -7022,7 +6868,6 @@ ZEND_VM_COLD_HANDLER(79, ZEND_EXIT, ANY, ANY)
SAVE_OPLINE();
if (OP1_TYPE != IS_UNUSED) {
- zend_free_op free_op1;
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
do {
@@ -7051,9 +6896,10 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
- if (EG(error_reporting)) {
+ if (!E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))) {
do {
- EG(error_reporting) = 0;
+ /* Do not silence fatal errors */
+ EG(error_reporting) &= E_FATAL_ERRORS;
if (!EG(error_reporting_ini_entry)) {
zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
if (zv) {
@@ -7082,7 +6928,8 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
{
USE_OPLINE
- if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(EX_VAR(opline->op1.var)))) {
EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
@@ -7091,7 +6938,6 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
@@ -7141,7 +6987,6 @@ ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
@@ -7181,7 +7026,6 @@ ZEND_VM_COLD_CONST_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_HOT_HANDLER(31, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -7342,7 +7186,6 @@ ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY, NUM)
ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
@@ -7384,8 +7227,6 @@ ZEND_VM_C_LABEL(try_instanceof):
}
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HOT_HANDLER(104, ZEND_EXT_NOP, ANY, ANY)
@@ -7510,7 +7351,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
break; /* return value is zend_class_entry pointer */
default:
- zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ /* smart branch opcodes may not initialize result */
+ if (!zend_is_smart_branch(throw_op)) {
+ zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ }
}
}
@@ -7551,7 +7395,6 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *name;
zval *val;
zend_constant c;
@@ -7643,7 +7486,7 @@ ZEND_VM_COLD_HELPER(zend_yield_in_closed_generator_helper, ANY, ANY)
HANDLE_EXCEPTION();
}
-ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED, SRC)
+ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMPVAR|CV|UNUSED, SRC)
{
USE_OPLINE
@@ -7662,8 +7505,6 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Set the new yielded value */
if (OP1_TYPE != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -7732,26 +7573,12 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Set the new yielded key */
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *key = GET_OP2_ZVAL_PTR(BP_VAR_R);
-
- /* Consts, temporary variables and references need copying */
- if (OP2_TYPE == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (OP2_TYPE == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((OP2_TYPE & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- FREE_OP2_IF_VAR();
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (OP2_TYPE == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((OP2_TYPE & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ FREE_OP2();
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -7784,17 +7611,14 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
ZEND_VM_RETURN();
}
-ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
- zend_free_op free_op1;
SAVE_OPLINE();
- val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
+ val = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
@@ -7803,23 +7627,21 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
HANDLE_EXCEPTION();
}
+ZEND_VM_C_LABEL(yield_from_try_again):
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (OP1_TYPE != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
-
- FREE_OP1_IF_VAR();
+ FREE_OP1();
} else if (OP1_TYPE != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
zend_class_entry *ce = Z_OBJCE_P(val);
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (OP1_TYPE != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
- FREE_OP1_IF_VAR();
+ Z_ADDREF_P(val);
+ FREE_OP1();
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -7865,6 +7687,9 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ ZEND_VM_C_GOTO(yield_from_try_again);
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -7949,7 +7774,6 @@ ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, TRY_CATCH)
ZEND_VM_HOT_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zend_string *varname;
zval *value;
zval *variable_ptr;
@@ -8033,7 +7857,6 @@ ZEND_VM_COLD_CONST_HANDLER(121, ZEND_STRLEN, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
@@ -8071,9 +7894,9 @@ ZEND_VM_COLD_CONST_HANDLER(121, ZEND_STRLEN, CONST|TMPVAR|CV, ANY)
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
FREE_OP1();
@@ -8085,7 +7908,6 @@ ZEND_VM_HOT_NOCONST_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMPVAR|CV, ANY, TYPE_MAS
USE_OPLINE
zval *value;
int result = 0;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
@@ -8112,12 +7934,8 @@ ZEND_VM_C_LABEL(type_check_resource):
SAVE_OPLINE();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
@@ -8131,13 +7949,9 @@ ZEND_VM_HOT_HANDLER(122, ZEND_DEFINED, CONST, ANY, CACHE_SLOT)
if (!IS_SPECIAL_CACHE_VAL(c)) {
ZEND_VM_C_LABEL(defined_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else if (EXPECTED(zend_hash_num_elements(EG(zend_constants)) == DECODE_SPECIAL_CACHE_NUM(c))) {
ZEND_VM_C_LABEL(defined_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
}
if (zend_quick_check_constant(RT_CONSTANT(opline, opline->op1) OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
@@ -8272,14 +8086,9 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- zend_vm_stack_free_call_frame(call);
- if (ret) {
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(call_trampoline_end);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
if (ret == NULL) {
ZVAL_NULL(&retval);
@@ -8295,6 +8104,9 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -8304,7 +8116,6 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
EG(current_execute_data) = call->prev_execute_data;
-ZEND_VM_C_LABEL(call_trampoline_end):
zend_vm_stack_free_args(call);
if (ret == &retval) {
zval_ptr_dtor(ret);
@@ -8336,7 +8147,6 @@ ZEND_VM_C_LABEL(call_trampoline_end):
ZEND_VM_HANDLER(182, ZEND_BIND_LEXICAL, TMP, CV, REF)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *closure, *var;
closure = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -8369,7 +8179,6 @@ ZEND_VM_HANDLER(182, ZEND_BIND_LEXICAL, TMP, CV, REF)
ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
{
USE_OPLINE
- zend_free_op free_op1;
HashTable *ht;
zval *value;
zval *variable_ptr;
@@ -8494,7 +8303,6 @@ ZEND_VM_HANDLER(140, ZEND_MAKE_REF, VAR|CV, UNUSED)
ZEND_VM_COLD_CONSTCONST_HANDLER(187, ZEND_SWITCH_LONG, CONST|TMPVARCV, CONST, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op, *jump_zv;
HashTable *jumptable;
@@ -8523,7 +8331,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(187, ZEND_SWITCH_LONG, CONST|TMPVARCV, CONST, JM
ZEND_VM_COLD_CONSTCONST_HANDLER(188, ZEND_SWITCH_STRING, CONST|TMPVARCV, CONST, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op, *jump_zv;
HashTable *jumptable;
@@ -8557,7 +8364,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(188, ZEND_SWITCH_STRING, CONST|TMPVARCV, CONST,
ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -8576,13 +8382,12 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -8590,14 +8395,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM
}
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_long count;
@@ -8608,9 +8410,11 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -8620,10 +8424,10 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (instanceof_function(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -8666,7 +8470,6 @@ ZEND_VM_COLD_CONST_HANDLER(191, ZEND_GET_CLASS, UNUSED|CONST|TMPVAR|CV, UNUSED)
ZEND_VM_NEXT_OPCODE();
}
} else {
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
@@ -8681,8 +8484,8 @@ ZEND_VM_COLD_CONST_HANDLER(191, ZEND_GET_CLASS, UNUSED|CONST|TMPVAR|CV, UNUSED)
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -8713,7 +8516,6 @@ ZEND_VM_HANDLER(192, ZEND_GET_CALLED_CLASS, UNUSED, UNUSED)
ZEND_VM_COLD_CONST_HANDLER(193, ZEND_GET_TYPE, CONST|TMP|VAR|CV, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
@@ -8815,7 +8617,6 @@ ZEND_VM_HANDLER(172, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED)
ZEND_VM_HANDLER(167, ZEND_COPY_TMP, TMPVAR, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R);
zval *result = EX_VAR(opline->result.var);
ZVAL_COPY(result, value);
@@ -8950,8 +8751,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_LONG && op2_inf
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
@@ -8964,8 +8763,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_i
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_NOT_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
@@ -8978,8 +8775,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_LONG && op2
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_NOT_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
@@ -8992,8 +8787,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_DOUBLE && o
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_SMALLER_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9006,8 +8799,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_i
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_SMALLER_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9020,8 +8811,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_SMALLER_OR_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9034,8 +8823,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_SMALLER_OR_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9048,8 +8835,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUB
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG_NO_OVERFLOW, CV, ANY, SPEC(RETVAL))
@@ -9151,7 +8936,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == MAY_BE_LONG), ZEND_POS
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_LONG), ZEND_QM_ASSIGN_LONG, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9162,7 +8946,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_LONG), ZEND_QM
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_DOUBLE), ZEND_QM_ASSIGN_DOUBLE, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9173,7 +8956,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_DOUBLE), ZEND_
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, ((op->op1_type == IS_CONST) ? !Z_REFCOUNTED_P(RT_CONSTANT(op, op->op1)) : (!(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE))))), ZEND_QM_ASSIGN_NOREF, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9184,7 +8966,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, ((op->op1_type == IS_CONST) ? !Z_R
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_FETCH_DIM_R, (!(op2_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))), ZEND_FETCH_DIM_R_INDEX, CONST|TMPVAR|CV, CONST|TMPVARCV, SPEC(NO_CONST_CONST))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -9238,7 +9019,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAR, (op1_info & (MAY_BE_UNDEF|MAY_BE_RE
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -9256,7 +9036,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAR_EX, op->op2.num <= MAX_ARG_FLAG_NUM
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -9279,7 +9058,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAL, op->op1_type == IS_CONST && !Z_REFC
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -9291,7 +9069,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAL_EX, op->op2.num <= MAX_ARG_FLAG_NUM
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index bb01bb1ee3..bf643d3fbd 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -578,6 +578,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_shift_right_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -587,29 +588,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_equal_hel
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_not_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -619,29 +610,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_not_equal
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) != 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret != 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -651,29 +632,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_h
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) < 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret < 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_or_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -683,25 +654,14 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_o
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) <= 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret <= 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_bw_or_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
@@ -797,7 +757,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
/* This helper actually never will receive IS_VAR as second op, and has the same handling for VAR and TMP in the first op, but for interoperability with the other binary_assign_op helpers, it is necessary to "include" it */
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
zend_reference *ref;
@@ -811,7 +770,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
HANDLE_EXCEPTION();
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (UNEXPECTED(Z_ISREF_P(prop))) {
@@ -823,7 +782,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
prop = Z_REFVAL_P(prop);
}
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
/* special case for typed properties */
zend_binary_assign_op_typed_prop(prop_info, prop, value OPLINE_CC EXECUTE_DATA_CC);
} else {
@@ -835,7 +794,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
ZVAL_COPY(EX_VAR(opline->result.var), prop);
}
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_static_prop has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -853,7 +812,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_STATIC_PROP_SPEC_HANDL
HANDLE_EXCEPTION();
}
- zend_pre_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -872,7 +832,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_STATIC_PROP_SPEC_HAND
HANDLE_EXCEPTION();
}
- zend_post_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -964,7 +925,6 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_us
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *prop, *value;
zend_property_info *prop_info;
@@ -978,7 +938,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
value = RT_CONSTANT((opline+1), (opline+1)->op1);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
} else {
@@ -996,7 +956,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -1008,11 +967,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
HANDLE_EXCEPTION();
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else {
value = zend_assign_to_variable(prop, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
@@ -1028,7 +987,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -1040,11 +998,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
HANDLE_EXCEPTION();
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else {
value = zend_assign_to_variable(prop, value, IS_VAR, EX_USES_STRICT_TYPES());
}
@@ -1060,7 +1018,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *prop, *value;
zend_property_info *prop_info;
@@ -1074,7 +1031,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
} else {
@@ -1092,7 +1049,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value_ptr;
zend_property_info *prop_info;
@@ -1104,15 +1060,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HA
HANDLE_EXCEPTION();
}
- value_ptr = get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, &free_op_data, BP_VAR_W);
+ value_ptr = get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, BP_VAR_W);
- if ((opline+1)->op1_type == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- prop = &EG(uninitialized_zval);
- } else if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
+ if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
if (UNEXPECTED(!zend_wrong_assign_to_variable_reference(prop, value_ptr OPLINE_CC EXECUTE_DATA_CC))) {
prop = &EG(uninitialized_zval);
}
- } else if (UNEXPECTED(prop_info->type)) {
+ } else if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
prop = zend_assign_to_typed_property_reference(prop_info, prop, value_ptr EXECUTE_DATA_CC);
} else {
zend_assign_to_variable_reference(prop, value_ptr);
@@ -1122,7 +1076,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HA
ZVAL_COPY(EX_VAR(opline->result.var), prop);
}
- if (free_op_data) {zval_ptr_dtor_nogc(free_op_data);};
+ if ((opline+1)->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));};
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -1262,6 +1216,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1269,6 +1227,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1307,6 +1268,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1314,6 +1279,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1425,15 +1393,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!0) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_by_name_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1442,6 +1404,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1509,15 +1474,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!1) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_by_name_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1526,6 +1485,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1558,27 +1520,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-fcall_except:
- UNDEF_RESULT();
- if (!0) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_end;
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- goto fcall_except;
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -1600,14 +1544,28 @@ fcall_except:
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!0) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ goto fcall_end;
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- goto fcall_except;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1621,6 +1579,9 @@ fcall_except:
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1635,19 +1596,6 @@ fcall_end:
if (!0) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = 0 ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!0) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -1670,27 +1618,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-fcall_except:
- UNDEF_RESULT();
- if (!1) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_end;
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- goto fcall_except;
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -1712,14 +1642,28 @@ fcall_except:
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!1) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ goto fcall_end;
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- goto fcall_except;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1733,6 +1677,9 @@ fcall_except:
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1747,19 +1694,6 @@ fcall_end:
if (!1) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = 1 ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!1) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -1869,12 +1803,11 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_ca
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
int arg_num;
SAVE_OPLINE();
- args = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ args = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
arg_num = ZEND_CALL_NUM_ARGS(EX(call)) + 1;
send_again:
@@ -1905,7 +1838,7 @@ send_again:
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
if (name) {
zend_throw_error(NULL, "Cannot unpack array with string keys");
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
HANDLE_EXCEPTION();
}
@@ -1935,12 +1868,12 @@ send_again:
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, args, 0);
if (UNEXPECTED(!iter)) {
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
if (!EG(exception)) {
zend_throw_exception_ex(
NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)
@@ -2012,21 +1945,20 @@ send_again:
if (opline->op1_type == IS_CV && UNEXPECTED(Z_TYPE_P(args) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
SAVE_OPLINE();
- args = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ args = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
if (UNEXPECTED(Z_TYPE_P(args) != IS_ARRAY)) {
if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_ISREF_P(args)) {
@@ -2035,16 +1967,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
goto send_array;
}
}
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
- if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(call)->func));
- } else if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_RELEASE_THIS) {
- OBJ_RELEASE(Z_OBJ(EX(call)->This));
- }
- EX(call)->func = (zend_function*)&zend_pass_function;
- Z_OBJ(EX(call)->This) = NULL;
- ZEND_CALL_INFO(EX(call)) &= ~(ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS);
+ zend_type_error("call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
+ FREE_OP(opline->op1_type, opline->op1.var);
+ HANDLE_EXCEPTION();
} else {
uint32_t arg_num;
HashTable *ht;
@@ -2054,8 +1980,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
send_array:
ht = Z_ARRVAL_P(args);
if (opline->op2_type != IS_UNUSED) {
- zend_free_op free_op2;
- zval *op2 = get_zval_ptr(opline->op2_type, opline->op2, &free_op2, BP_VAR_R);
+ zval *op2 = get_zval_ptr(opline->op2_type, opline->op2, BP_VAR_R);
uint32_t skip = opline->extended_value;
uint32_t count = zend_hash_num_elements(ht);
zend_long len = zval_get_long(op2);
@@ -2097,7 +2022,7 @@ send_array:
param++;
} ZEND_HASH_FOREACH_END();
}
- FREE_OP(free_op2);
+ FREE_OP(opline->op2_type, opline->op2.var);
} else {
zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht));
arg_num = 1;
@@ -2125,12 +2050,13 @@ send_array:
} ZEND_HASH_FOREACH_END();
}
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_case_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -2140,32 +2066,20 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_case_helper_
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
- op1 = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ op1 = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
add_unpack_again:
if (EXPECTED(Z_TYPE_P(op1) == IS_ARRAY)) {
@@ -2176,7 +2090,7 @@ add_unpack_again:
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
if (key) {
zend_throw_error(NULL, "Cannot unpack array with string keys");
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
HANDLE_EXCEPTION();
} else {
if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) {
@@ -2195,11 +2109,11 @@ add_unpack_again:
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, op1, 0);
if (UNEXPECTED(!iter)) {
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
if (!EG(exception)) {
zend_throw_exception_ex(
NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)
@@ -2261,7 +2175,7 @@ add_unpack_again:
zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2271,7 +2185,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
zval *varname;
zend_string *name, *tmp_name = NULL;
zend_class_entry *ce;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -2297,7 +2210,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- varname = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ varname = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
if (opline->op1_type == IS_CONST) {
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
@@ -2306,13 +2219,17 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
if (opline->op1_type == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
varname = ZVAL_UNDEFINED_OP1();
}
- name = zval_get_tmp_string(varname, &tmp_name);
+ name = zval_try_get_tmp_string(varname, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP(opline->op1_type, opline->op1.var);
+ HANDLE_EXCEPTION();
+ }
}
zend_std_unset_static_property(ce, name);
zend_tmp_string_release(tmp_name);
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2334,8 +2251,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -2344,8 +2259,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER
SAVE_OPLINE();
if (opline->op1_type != IS_UNUSED) {
- zend_free_op free_op1;
- zval *ptr = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ zval *ptr = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
do {
if (Z_TYPE_P(ptr) == IS_LONG) {
@@ -2361,7 +2275,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER
zend_print_zval(ptr, 0);
}
} while (0);
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
}
zend_bailout();
ZEND_VM_NEXT_OPCODE(); /* Never reached */
@@ -2373,9 +2287,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEN
ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
- if (EG(error_reporting)) {
+ if (!E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))) {
do {
- EG(error_reporting) = 0;
+ /* Do not silence fatal errors */
+ EG(error_reporting) &= E_FATAL_ERRORS;
if (!EG(error_reporting_ini_entry)) {
zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
if (zv) {
@@ -2607,7 +2522,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
break; /* return value is zend_class_entry pointer */
default:
- zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ /* smart branch opcodes may not initialize result */
+ if (!zend_is_smart_branch(throw_op)) {
+ zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ }
}
}
@@ -2791,14 +2709,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- zend_vm_stack_free_call_frame(call);
- if (ret) {
- ZVAL_UNDEF(ret);
- }
- goto call_trampoline_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
if (ret == NULL) {
ZVAL_NULL(&retval);
@@ -2814,6 +2727,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -2823,7 +2739,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
EG(current_execute_data) = call->prev_execute_data;
-call_trampoline_end:
zend_vm_stack_free_args(call);
if (ret == &retval) {
zval_ptr_dtor(ret);
@@ -2903,7 +2818,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_execute_data *call;
@@ -2914,7 +2828,7 @@ try_function_name:
if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3058,10 +2972,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CON
} else {
recv_init_check_type:
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
- zval *default_value = RT_CONSTANT(opline, opline->op2);
-
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(opline->extended_value)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -3074,18 +2986,17 @@ recv_init_check_type:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_execute_data *call;
SAVE_OPLINE();
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
try_function_name:
if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3106,7 +3017,7 @@ try_function_name:
HANDLE_EXCEPTION();
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -3141,7 +3052,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_UNUSED_H
zval *param = EX_VAR(opline->result.var);
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -3169,7 +3080,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
- zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
+ zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;
@@ -3192,7 +3103,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_execute_data *call;
@@ -3203,7 +3113,7 @@ try_function_name:
if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3248,7 +3158,6 @@ try_function_name:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -3271,7 +3180,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CON
USE_OPLINE
zval *val;
-
val = RT_CONSTANT(opline, opline->op1);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -3294,7 +3202,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *z;
SAVE_OPLINE();
@@ -3323,8 +3230,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_O
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3342,20 +3249,23 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_H
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3373,20 +3283,23 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3405,19 +3318,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -3454,7 +3369,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONS
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -3492,7 +3406,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = RT_CONSTANT(opline, opline->op1);
return_value = EX(return_value);
@@ -3504,9 +3417,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
}
} else if (!return_value) {
if (IS_CONST & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -3561,7 +3474,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPE
USE_OPLINE
zval *retval_ptr;
-
SAVE_OPLINE();
do {
@@ -3621,7 +3533,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_CONST_HA
USE_OPLINE
zval *retval;
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
@@ -3665,7 +3576,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_
USE_OPLINE
zval *value;
-
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op1);
@@ -3690,10 +3600,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_
} while (0);
zend_exception_save();
- if (IS_CONST != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
@@ -3758,7 +3665,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONS
USE_OPLINE
zval *value, *arg;
-
value = RT_CONSTANT(opline, opline->op1);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
@@ -3774,7 +3680,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -3800,7 +3705,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_C
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -3827,7 +3731,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CONST_HANDLER(Z
USE_OPLINE
zval *arg, *param;
-
SAVE_OPLINE();
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
@@ -3846,7 +3749,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_H
USE_OPLINE
zval *val;
-
val = RT_CONSTANT(opline, opline->op1);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -3869,8 +3771,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_H
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -3904,9 +3806,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -3927,7 +3830,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -3935,7 +3838,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -4029,7 +3931,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN
{
USE_OPLINE
zend_op_array *new_op_array;
-
zval *inc_filename;
SAVE_OPLINE();
@@ -4094,7 +3995,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -4110,20 +4010,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
ZEND_VM_NEXT_OPCODE();
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_CONST != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -4149,7 +4056,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -4242,7 +4148,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
int ret;
@@ -4291,7 +4196,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONS
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
@@ -4330,7 +4234,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CON
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -4378,12 +4281,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
-
SAVE_OPLINE();
val = RT_CONSTANT(opline, opline->op1);
@@ -4394,9 +4294,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
HANDLE_EXCEPTION();
}
+yield_from_try_again:
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_CONST != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
@@ -4406,9 +4307,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (IS_CONST != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
+ Z_ADDREF_P(val);
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -4453,6 +4352,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -4484,7 +4386,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST
USE_OPLINE
zval *value;
-
value = RT_CONSTANT(opline, opline->op1);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
@@ -4521,9 +4422,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
@@ -4536,7 +4437,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_C
zval *value;
int result = 0;
-
value = RT_CONSTANT(opline, opline->op1);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
@@ -4562,12 +4462,8 @@ type_check_resource:
SAVE_OPLINE();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
@@ -4581,13 +4477,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DEFINED_SPEC_CONST
if (!IS_SPECIAL_CACHE_VAL(c)) {
defined_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else if (EXPECTED(zend_hash_num_elements(EG(zend_constants)) == DECODE_SPECIAL_CACHE_NUM(c))) {
defined_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
}
if (zend_quick_check_constant(RT_CONSTANT(opline, opline->op1) OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
@@ -4601,7 +4493,6 @@ defined_false:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4612,7 +4503,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4623,7 +4513,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_S
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4636,7 +4525,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SIMPLE_SP
USE_OPLINE
zval *value, *arg;
-
value = RT_CONSTANT(opline, opline->op1);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
@@ -4647,7 +4535,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SIMPLE
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -4662,7 +4549,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SIMPLE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4701,7 +4587,6 @@ add_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4740,7 +4625,6 @@ sub_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4782,7 +4666,6 @@ mul_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -4797,7 +4680,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4825,7 +4707,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4847,7 +4728,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4867,7 +4747,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -4882,7 +4761,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -4893,14 +4771,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -4911,14 +4786,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -4931,13 +4803,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CON
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -4981,7 +4849,6 @@ is_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -4994,13 +4861,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5044,7 +4907,6 @@ is_not_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -5057,13 +4919,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_C
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5092,7 +4950,6 @@ is_smaller_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -5140,7 +4997,6 @@ is_smaller_or_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -5155,7 +5011,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5174,7 +5029,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5193,7 +5047,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5212,7 +5065,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -5227,7 +5079,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -5263,7 +5114,6 @@ fetch_dim_r_slow:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -5296,9 +5146,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_AR
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -5335,9 +5183,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -5362,10 +5212,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -5376,7 +5226,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5388,11 +5238,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -5411,9 +5272,7 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -5443,9 +5302,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -5470,10 +5331,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -5484,7 +5345,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5496,9 +5357,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -5534,7 +5405,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -5547,7 +5417,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -5669,7 +5538,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -5764,7 +5632,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -5794,9 +5661,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -5855,8 +5725,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -5892,7 +5760,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -5923,13 +5790,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -5954,7 +5817,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -5966,16 +5828,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
SAVE_OPLINE();
function_name = RT_CONSTANT(opline, opline->op2);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
-
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -6007,14 +5861,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -6099,7 +5949,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -6138,7 +5987,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -6218,7 +6066,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HA
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -6253,6 +6100,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -6264,8 +6115,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -6291,17 +6140,15 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
@@ -6326,23 +6173,34 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -6368,8 +6226,6 @@ array_key_exists_array:
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -6404,7 +6260,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_DELAYED_SPEC_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *name;
zval *val;
zend_constant c;
@@ -6452,8 +6307,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -6521,26 +6374,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -6576,7 +6414,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -6605,7 +6442,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -6639,7 +6475,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -6658,13 +6493,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CON
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -6672,14 +6506,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CON
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -6718,7 +6549,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -6757,7 +6587,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6785,7 +6614,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMPVARCV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6807,7 +6635,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMPVARCV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6827,7 +6654,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMPVARCV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6839,14 +6665,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6875,7 +6697,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6888,13 +6709,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CO
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6923,7 +6740,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6936,13 +6752,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CO
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6971,7 +6783,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6983,12 +6794,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -7019,7 +6830,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -7067,7 +6877,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -7157,9 +6966,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMP
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7172,8 +6979,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7186,8 +6991,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7199,9 +7002,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_T
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7214,8 +7015,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7228,8 +7027,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7241,9 +7038,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7256,8 +7051,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7270,8 +7063,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7283,9 +7074,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7298,8 +7087,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7312,14 +7099,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -7372,41 +7156,38 @@ fetch_dim_r_index_undef:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -7466,7 +7247,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -7474,27 +7255,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -7517,7 +7296,7 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7525,13 +7304,12 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7558,9 +7336,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -7571,7 +7347,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -7597,9 +7373,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -7624,10 +7402,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -7638,7 +7416,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -7650,11 +7428,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -7665,7 +7454,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7673,9 +7462,7 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -7686,7 +7473,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -7705,9 +7492,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -7732,10 +7521,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -7746,7 +7535,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -7758,9 +7547,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -7771,7 +7570,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7796,26 +7595,24 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -7923,7 +7720,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7931,7 +7728,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -7948,7 +7744,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -7967,7 +7763,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -7986,16 +7782,16 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -8012,7 +7808,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -8021,12 +7817,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -8041,7 +7836,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -8056,9 +7851,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -8117,9 +7915,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -8135,7 +7931,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
}
}
zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -8150,11 +7946,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -8162,7 +7957,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -8185,13 +7980,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -8216,7 +8007,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -8226,18 +8016,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
SAVE_OPLINE();
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op2);
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -8256,7 +8038,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS;
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release(ZEND_CLOSURE_OBJECT(func));
@@ -8270,14 +8052,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -8291,7 +8069,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -8330,8 +8107,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -8376,7 +8152,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -8410,7 +8186,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -8418,7 +8193,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -8445,6 +8220,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -8454,10 +8233,8 @@ num_index_prop:
if (IS_CONST & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -8480,20 +8257,18 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
@@ -8502,7 +8277,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -8518,23 +8293,34 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -8542,7 +8328,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TM
SAVE_OPLINE();
key = RT_CONSTANT(opline, opline->op1);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -8558,155 +8344,13 @@ array_key_exists_array:
result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_CONST != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_CONST & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = RT_CONSTANT(opline, opline->op1);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CONST == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_CONST == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = RT_CONSTANT(opline, opline->op1);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -8725,8 +8369,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -8793,27 +8435,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
}
/* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -8849,7 +8477,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
-
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -8891,7 +8518,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -8910,7 +8537,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -9035,8 +8662,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -9072,7 +8697,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -9103,13 +8727,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -9142,7 +8762,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP
/* prevents "undefined variable opline" errors */
#if 0 || (IS_CONST != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
retval_ref = retval_ptr = RT_CONSTANT(opline, opline->op1);
@@ -9160,9 +8779,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -9255,7 +8873,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_UNUSED_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -9294,7 +8911,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_U
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -9378,7 +8994,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HA
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
-
SAVE_OPLINE();
varname = RT_CONSTANT(opline, opline->op1);
@@ -9415,7 +9030,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U
USE_OPLINE
zval *value;
int result;
-
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -9452,8 +9066,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
@@ -9511,8 +9123,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -9580,26 +9190,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -9635,7 +9230,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_long count;
@@ -9646,9 +9240,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -9658,10 +9254,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (instanceof_function(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -9704,7 +9300,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -9719,8 +9314,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -9732,7 +9327,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_string *type;
@@ -9826,7 +9420,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_CONST_UNUSE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9841,7 +9434,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9856,7 +9448,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -9928,7 +9519,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9943,7 +9533,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -9979,7 +9568,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -10012,9 +9600,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -10051,9 +9637,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -10078,10 +9666,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -10092,7 +9680,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -10104,11 +9692,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -10127,9 +9726,7 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -10159,9 +9756,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -10186,10 +9785,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -10200,7 +9799,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -10212,9 +9811,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -10250,7 +9859,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -10263,7 +9871,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -10385,7 +9992,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -10480,7 +10086,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -10510,9 +10115,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -10571,8 +10179,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -10608,7 +10214,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -10639,13 +10244,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -10670,7 +10271,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -10682,16 +10282,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
SAVE_OPLINE();
function_name = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
-
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -10723,14 +10315,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -10744,7 +10332,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -10783,7 +10370,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -10863,7 +10449,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -10898,6 +10483,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -10909,8 +10498,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -10936,17 +10523,15 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
@@ -10971,23 +10556,34 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -11013,8 +10609,6 @@ array_key_exists_array:
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -11037,8 +10631,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -11106,26 +10698,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -11161,7 +10738,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11172,7 +10748,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11183,7 +10758,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_S
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11194,7 +10768,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SP
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11233,7 +10806,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11272,7 +10844,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11314,7 +10885,6 @@ mul_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = EX_VAR(opline->op1.var);
@@ -11342,7 +10912,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11364,7 +10933,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11384,7 +10952,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11396,14 +10963,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11432,7 +10995,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11445,13 +11007,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11480,7 +11038,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11493,13 +11050,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11528,7 +11081,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11540,12 +11092,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -11576,7 +11128,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11624,7 +11175,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11672,7 +11222,6 @@ is_smaller_or_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11691,7 +11240,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11710,7 +11258,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11729,7 +11276,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -11742,7 +11288,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -11771,7 +11316,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -11921,9 +11465,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CO
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11936,8 +11478,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11950,8 +11490,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11963,9 +11501,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11978,8 +11514,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11992,8 +11526,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12005,9 +11537,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12020,8 +11550,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12034,8 +11562,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12047,9 +11573,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12062,8 +11586,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12076,8 +11598,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12089,9 +11609,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12104,8 +11622,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12118,8 +11634,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12131,9 +11645,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12146,8 +11658,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12160,8 +11670,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12173,9 +11681,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12188,8 +11694,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12202,8 +11706,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12215,9 +11717,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12230,8 +11730,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12244,14 +11742,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12290,7 +11785,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12329,7 +11823,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12371,7 +11864,6 @@ mul_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = EX_VAR(opline->op1.var);
@@ -12399,7 +11891,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_TMPVARCV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12421,7 +11912,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_TMPVARCV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12441,7 +11931,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_TMPVARCV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12453,14 +11942,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12489,7 +11974,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12502,13 +11986,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12537,7 +12017,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12550,13 +12029,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12585,7 +12060,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12597,12 +12071,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -12633,7 +12107,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12681,7 +12154,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12729,7 +12201,6 @@ is_smaller_or_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12748,7 +12219,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_TMPVARCV_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12767,7 +12237,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_TMPVARCV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12902,9 +12371,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TM
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12917,8 +12384,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12931,8 +12396,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12944,9 +12407,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12959,8 +12420,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12973,8 +12432,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12986,9 +12443,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13001,8 +12456,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13015,8 +12468,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13028,9 +12479,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13043,8 +12492,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13057,8 +12504,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13070,9 +12515,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13085,8 +12528,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13099,8 +12540,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13112,9 +12551,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13127,8 +12564,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13141,8 +12576,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13154,9 +12587,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13169,8 +12600,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13183,8 +12612,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13196,9 +12623,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13211,8 +12636,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13225,27 +12648,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -13258,10 +12677,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
ZVAL_LONG(EX_VAR(opline->result.var), ~Z_LVAL_P(op1));
ZEND_VM_NEXT_OPCODE();
@@ -13272,7 +12690,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMPVAR_HANDLER(ZEN
op1 = ZVAL_UNDEFINED_OP1();
}
bitwise_not_function(EX_VAR(opline->result.var), op1);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13280,9 +12698,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
@@ -13295,7 +12712,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
} else {
SAVE_OPLINE();
ZVAL_BOOL(EX_VAR(opline->result.var), !i_zend_is_true(val));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -13304,11 +12721,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *z;
SAVE_OPLINE();
- z = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ z = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_P(z) == IS_STRING) {
zend_string *str = Z_STR_P(z);
@@ -13327,17 +12743,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_
zend_string_release_ex(str, 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZEND_VM_NEXT_OPCODE();
@@ -13353,22 +12769,25 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_H
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
@@ -13384,22 +12803,25 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMPVAR_
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_INFO_P(val) == IS_TRUE)) {
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -13416,23 +12838,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMPVAR_HANDLER(ZEN
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -13451,7 +12875,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE
SAVE_OPLINE();
ret = i_zend_is_true(val);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (ret) {
ZVAL_TRUE(EX_VAR(opline->result.var));
opline++;
@@ -13465,11 +12889,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -13487,7 +12910,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(Z
SAVE_OPLINE();
ret = i_zend_is_true(val);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (ret) {
ZVAL_TRUE(EX_VAR(opline->result.var));
opline = OP_JMP_ADDR(opline, opline->op2);
@@ -13521,13 +12944,48 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FREE_SPEC_TMPVA
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ do {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
+ if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
+ value = Z_REFVAL_P(value);
+ if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
+ break;
+ }
+ }
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP1();
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ HANDLE_EXCEPTION();
+ }
+ }
+ zend_throw_error(NULL, "Can only throw objects");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ HANDLE_EXCEPTION();
+ }
+ } while (0);
+
+ zend_exception_save();
+ Z_TRY_ADDREF_P(value);
+ zend_throw_exception_object(value);
+ zend_exception_restore();
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ HANDLE_EXCEPTION();
+}
+
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
@@ -13542,9 +13000,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
@@ -13557,7 +13014,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
} else {
SAVE_OPLINE();
ZVAL_BOOL(EX_VAR(opline->result.var), i_zend_is_true(val));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -13566,14 +13023,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
SAVE_OPLINE();
- obj = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ obj = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -13596,17 +13053,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
}
}
zend_throw_error(NULL, "__clone method called on non-object");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -13617,16 +13075,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
if (UNEXPECTED(clone->common.fn_flags & ZEND_ACC_PRIVATE)
|| UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
zend_wrong_clone_call(clone, scope);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13634,13 +13092,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA
{
USE_OPLINE
zend_op_array *new_op_array;
- zend_free_op free_op1;
zval *inc_filename;
SAVE_OPLINE();
- inc_filename = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ inc_filename = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
new_op_array = zend_include_or_eval(inc_filename, opline->extended_value);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != ZEND_FAKE_OP_ARRAY && new_op_array != NULL) {
destroy_op_array(new_op_array);
@@ -13696,16 +13153,120 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA
ZEND_VM_NEXT_OPCODE();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
+ zval *val;
+
+ SAVE_OPLINE();
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
+ zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+yield_from_try_again:
+ if (Z_TYPE_P(val) == IS_ARRAY) {
+ ZVAL_COPY_VALUE(&generator->values, val);
+ if (Z_OPT_REFCOUNTED_P(val)) {
+ Z_ADDREF_P(val);
+ }
+ Z_FE_POS(generator->values) = 0;
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ } else if ((IS_TMP_VAR|IS_VAR) != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
+ zend_class_entry *ce = Z_OBJCE_P(val);
+ if (ce == zend_ce_generator) {
+ zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
+
+ Z_ADDREF_P(val);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+
+ if (Z_ISUNDEF(new_gen->retval)) {
+ if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
+ zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
+ zval_ptr_dtor(val);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ } else {
+ zend_generator_yield_from(generator, new_gen);
+ }
+ } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
+ zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
+ zval_ptr_dtor(val);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ } else {
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
+ }
+ ZEND_VM_NEXT_OPCODE();
+ }
+ } else {
+ zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+
+ if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+ }
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+ iter->index = 0;
+ if (iter->funcs->rewind) {
+ iter->funcs->rewind(iter);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ OBJ_RELEASE(&iter->std);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+ }
+
+ ZVAL_OBJ(&generator->values, &iter->std);
+ }
+ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
+ } else {
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+ /* This is the default return value
+ * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* This generator has no send target (though the generator we delegate to might have one) */
+ generator->send_target = NULL;
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
} else {
zend_bool strict;
@@ -13714,7 +13275,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEN
value = Z_REFVAL_P(value);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
}
@@ -13738,12 +13299,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEN
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13752,9 +13313,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TM
USE_OPLINE
zval *value;
int result = 0;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
if (EXPECTED(Z_TYPE_P(value) != IS_RESOURCE)
@@ -13777,28 +13337,23 @@ type_check_resource:
}
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13806,14 +13361,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CONST_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13821,10 +13375,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CONST_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
@@ -13884,7 +13437,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13893,11 +13446,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -13905,14 +13457,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HAN
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -13956,11 +13504,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -13969,13 +13516,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14019,11 +13562,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14032,13 +13574,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14082,11 +13620,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14094,14 +13631,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14145,11 +13678,10 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14158,13 +13690,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14208,11 +13736,10 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14221,13 +13748,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14271,14 +13794,13 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14286,14 +13808,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14301,11 +13822,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -14330,35 +13850,32 @@ fetch_dim_r_slow:
zend_fetch_dimension_address_read_R(container, dim, IS_CONST OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_read_IS(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -14390,9 +13907,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CONST_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -14417,10 +13936,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -14431,7 +13950,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -14443,11 +13962,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -14459,21 +13989,19 @@ fetch_obj_r_copy:
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -14498,9 +14026,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -14525,10 +14055,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -14539,7 +14069,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -14551,9 +14081,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -14565,19 +14105,18 @@ fetch_obj_is_copy:
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
(IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -14685,7 +14224,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14694,7 +14233,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -14704,7 +14242,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -14725,13 +14263,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -14759,7 +14297,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -14785,11 +14323,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -14809,7 +14346,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -14820,9 +14357,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -14839,24 +14379,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14895,14 +14430,13 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -14930,6 +14464,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -14941,8 +14479,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -14966,22 +14502,20 @@ num_index_prop:
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -15003,30 +14537,41 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *key, *subject;
HashTable *ht;
uint32_t result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
subject = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
@@ -15043,22 +14588,19 @@ array_key_exists_array:
result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -15076,7 +14618,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -15093,21 +14635,18 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_index_array:
@@ -15121,7 +14660,7 @@ fetch_dim_r_index_array:
ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_NEXT_OPCODE();
@@ -15140,7 +14679,7 @@ fetch_dim_r_index_slow:
dim++;
}
zend_fetch_dimension_address_read_R_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -15148,19 +14687,18 @@ fetch_dim_r_index_undef:
ZVAL_NULL(EX_VAR(opline->result.var));
SAVE_OPLINE();
zend_undefined_offset(offset);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_index_array:
@@ -15174,7 +14712,7 @@ fetch_dim_r_index_array:
ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_NEXT_OPCODE();
@@ -15193,7 +14731,7 @@ fetch_dim_r_index_slow:
dim++;
}
zend_fetch_dimension_address_read_R_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -15201,48 +14739,45 @@ fetch_dim_r_index_undef:
ZVAL_NULL(EX_VAR(opline->result.var));
SAVE_OPLINE();
zend_undefined_offset(offset);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -15301,8 +14836,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -15310,26 +14845,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15373,12 +14903,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15386,13 +14915,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15436,12 +14961,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15449,13 +14973,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15499,26 +15019,21 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15562,12 +15077,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15575,13 +15089,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15625,12 +15135,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15638,13 +15147,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15688,42 +15193,39 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -15746,42 +15248,39 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -15807,9 +15306,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_TMPVAR
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -15834,10 +15335,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -15848,7 +15349,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15860,11 +15361,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -15875,28 +15387,26 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -15915,9 +15425,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -15942,10 +15454,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -15956,7 +15468,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15968,9 +15480,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -15981,21 +15503,20 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -16102,8 +15623,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16111,7 +15632,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -16121,14 +15641,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -16142,13 +15662,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -16166,17 +15686,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -16192,7 +15712,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -16201,12 +15721,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -16221,12 +15740,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -16237,9 +15756,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -16256,24 +15778,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -16298,7 +15815,7 @@ case_double:
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (result) {
goto case_true;
} else {
@@ -16312,15 +15829,14 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -16347,6 +15863,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -16356,10 +15876,8 @@ num_index_prop:
if ((IS_TMP_VAR|IS_VAR) & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -16382,29 +15900,27 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -16420,31 +15936,42 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *key, *subject;
HashTable *ht;
uint32_t result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -16460,23 +15987,20 @@ array_key_exists_array:
result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -16494,7 +16018,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16511,23 +16035,20 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMPVAR_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
@@ -16540,7 +16061,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_ad
}
name = zval_try_get_tmp_string(varname, &tmp_name);
if (UNEXPECTED(!name)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16562,7 +16083,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -16581,7 +16102,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -16592,7 +16113,7 @@ fetch_this:
}
if (!(opline->extended_value & ZEND_FETCH_GLOBAL_LOCK)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
@@ -16648,11 +16169,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
- zend_free_op free_op1;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
@@ -16665,7 +16185,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
}
name = zval_try_get_tmp_string(varname, &tmp_name);
if (UNEXPECTED(!name)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
@@ -16676,7 +16196,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_tmp_string_release(tmp_name);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16686,13 +16206,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
USE_OPLINE
zval *value;
int result;
- zend_free_op free_op1;
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
} else {
@@ -16705,7 +16224,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_tmp_string_release(tmp_name);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (!value) {
result = (opline->extended_value & ZEND_ISEMPTY);
@@ -16724,20 +16243,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -16755,7 +16271,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16772,29 +16288,28 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_long count;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
while (1) {
if (Z_TYPE_P(op1) == IS_ARRAY) {
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -16804,10 +16319,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (instanceof_function(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -16831,7 +16346,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
}
ZVAL_LONG(EX_VAR(opline->result.var), count);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16850,11 +16365,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
ZEND_VM_NEXT_OPCODE();
}
} else {
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
while (1) {
if (Z_TYPE_P(op1) == IS_OBJECT) {
ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op1)->name);
@@ -16865,12 +16379,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -16878,8 +16392,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zval *result = EX_VAR(opline->result.var);
ZVAL_COPY(result, value);
ZEND_VM_NEXT_OPCODE();
@@ -16888,14 +16401,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16903,14 +16415,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16918,10 +16429,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
@@ -16981,7 +16491,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16990,14 +16500,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -17005,11 +16514,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -17034,35 +16542,32 @@ fetch_dim_r_slow:
zend_fetch_dimension_address_read_R(container, dim, IS_CV OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_read_IS(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -17094,9 +16599,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CV_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -17121,10 +16628,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -17135,7 +16642,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -17147,11 +16654,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -17163,21 +16681,19 @@ fetch_obj_r_copy:
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -17202,9 +16718,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -17229,10 +16747,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -17243,7 +16761,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -17255,9 +16773,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -17269,19 +16797,18 @@ fetch_obj_is_copy:
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
(IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -17389,7 +16916,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HAN
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -17398,7 +16925,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -17408,7 +16934,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -17429,13 +16955,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -17463,7 +16989,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -17489,11 +17015,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -17513,7 +17038,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -17524,9 +17049,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -17543,24 +17071,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -17599,14 +17122,13 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -17634,6 +17156,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -17645,8 +17171,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -17670,22 +17194,20 @@ num_index_prop:
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -17707,30 +17229,41 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *key, *subject;
HashTable *ht;
uint32_t result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
subject = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
@@ -17747,10 +17280,8 @@ array_key_exists_array:
result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -17759,9 +17290,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -17771,9 +17301,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
}
} else if (!return_value) {
if (IS_TMP_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -17827,7 +17357,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -17837,9 +17366,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER
/* Not supposed to happen, but we'll allow it */
zend_error(E_NOTICE, "Only variable references should be returned by reference");
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (!EX(return_value)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
@@ -17887,12 +17416,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_TMP_HAND
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
- retval = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Copy return value into generator->retval */
if ((IS_TMP_VAR & (IS_CONST|IS_TMP_VAR))) {
@@ -17927,51 +17455,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_TMP_HAND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zval *value;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- do {
- if (IS_TMP_VAR == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
- if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
- break;
- }
- }
- if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP1();
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- }
- zend_throw_error(NULL, "Can only throw objects");
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
- }
- } while (0);
-
- zend_exception_save();
- if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
- zend_throw_exception_object(value);
- zend_exception_restore();
-
- HANDLE_EXCEPTION();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -17982,7 +17469,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(Z
send_val_by_ref:
ZEND_VM_TAIL_CALL(zend_cannot_pass_by_ref_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if (IS_TMP_VAR == IS_CONST) {
@@ -17997,7 +17484,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_T
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -18008,7 +17494,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_T
send_val_by_ref:
ZEND_VM_TAIL_CALL(zend_cannot_pass_by_ref_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if (IS_TMP_VAR == IS_CONST) {
@@ -18023,7 +17509,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_TMP_HANDLER(ZEN
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -18031,23 +17516,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_TMP_HANDLER(ZEN
zend_param_must_be_ref(EX(call)->func, opline->op2.num);
}
- arg = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ arg = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY(param, arg);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
SAVE_OPLINE();
- expr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
switch (opline->extended_value) {
case IS_NULL:
@@ -18128,19 +17612,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
}
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
- array_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
@@ -18151,26 +17634,33 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
ZEND_VM_NEXT_OPCODE();
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
} else if (is_empty) {
@@ -18183,7 +17673,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
}
@@ -18191,7 +17681,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -18202,7 +17691,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
array_ptr = Z_REFVAL_P(array_ref);
}
} else {
- array_ref = array_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
}
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
@@ -18258,7 +17747,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
if (IS_TMP_VAR == IS_VAR) {
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -18275,7 +17764,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
if (IS_TMP_VAR == IS_VAR) {
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
@@ -18285,7 +17774,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(Z
{
USE_OPLINE
- if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(EX_VAR(opline->op1.var)))) {
EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
@@ -18294,13 +17784,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(value)) {
if (IS_TMP_VAR == IS_VAR) {
@@ -18312,7 +17801,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_
ret = i_zend_is_true(value);
if (UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -18337,19 +17826,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
if (IS_TMP_VAR & IS_VAR) {
@@ -18377,18 +17865,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_TMP_HANDLER(ZEND
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -18420,145 +17907,34 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP
ZEND_VM_NEXT_OPCODE();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- zval *val;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- val = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
- zval_ptr_dtor_nogc(free_op1);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (Z_TYPE_P(val) == IS_ARRAY) {
- ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_TMP_VAR != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- Z_FE_POS(generator->values) = 0;
-
- } else if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
- zend_class_entry *ce = Z_OBJCE_P(val);
- if (ce == zend_ce_generator) {
- zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
-
- if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
-
- if (Z_ISUNDEF(new_gen->retval)) {
- if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
- zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- zend_generator_yield_from(generator, new_gen);
- }
- } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
- zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
- }
- ZEND_VM_NEXT_OPCODE();
- }
- } else {
- zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
- zval_ptr_dtor_nogc(free_op1);
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (!EG(exception)) {
- zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
- }
-
- ZVAL_OBJ(&generator->values, &iter->std);
- }
- } else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- /* This is the default return value
- * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
-
- /* This generator has no send target (though the generator we delegate to might have one) */
- generator->send_target = NULL;
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -18600,7 +17976,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -18636,7 +18011,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -18693,7 +18067,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -18707,7 +18080,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CON
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -18732,7 +18105,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CON
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -18828,8 +18200,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -18838,7 +18208,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -18870,7 +18240,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -18897,26 +18267,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -18952,13 +18307,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
result = zend_hash_find_ex(ht, Z_STR_P(op1), IS_TMP_VAR == IS_CONST);
} else if (opline->extended_value) {
@@ -18971,22 +18325,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_TMP_CONST_HANDLE
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
} ZEND_HASH_FOREACH_END();
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -19028,20 +18379,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
/* op1 and result are the same */
rope = (zend_string**)EX_VAR(opline->op1.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[opline->extended_value] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[opline->extended_value] = zend_string_copy(Z_STR_P(var));
@@ -19054,7 +18404,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDL
ZVAL_UNDEFINED_OP2();
}
rope[opline->extended_value] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -19064,7 +18414,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -19073,13 +18422,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
rope = (zend_string**)EX_VAR(opline->op1.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[opline->extended_value] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[opline->extended_value] = zend_string_copy(Z_STR_P(var));
@@ -19092,7 +18441,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
ZVAL_UNDEFINED_OP2();
}
rope[opline->extended_value] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (UNEXPECTED(EG(exception))) {
for (i = 0; i <= opline->extended_value; i++) {
zend_string_release_ex(rope[i], 0);
@@ -19121,7 +18470,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -19135,7 +18483,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -19160,8 +18508,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -19206,7 +18553,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -19237,43 +18584,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR_HAN
}
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -19292,8 +18603,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -19302,7 +18611,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -19334,7 +18643,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -19360,27 +18669,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -19413,144 +18708,34 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
+ zval *op1, *op2;
+ zend_bool result;
SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_TMP_VAR & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_TMP_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_TMP_VAR == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
SAVE_OPLINE();
-
- ZEND_VM_RETURN();
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -19583,10 +18768,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
/* prevents "undefined variable opline" errors */
#if 0 || (IS_TMP_VAR != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
- retval_ref = retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ref = retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CONST) {
ZVAL_COPY(EX_VAR(opline->result.var), retval_ptr);
@@ -19601,9 +18785,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -19625,7 +18808,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -19639,7 +18821,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNU
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -19664,7 +18846,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNU
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -19760,8 +18941,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -19770,7 +18949,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -19802,7 +18981,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -19829,26 +19008,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -19884,19 +19048,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
type = zend_zval_get_type(op1);
if (EXPECTED(type)) {
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
} else {
ZVAL_STRING(EX_VAR(opline->result.var), "unknown type");
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -19939,7 +19102,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -19975,7 +19137,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -20032,7 +19193,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -20046,7 +19206,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -20071,7 +19231,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -20167,8 +19326,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -20177,7 +19334,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -20209,7 +19366,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -20236,26 +19393,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -20291,10 +19433,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_LEXICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *closure, *var;
- closure = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ closure = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (opline->extended_value & ZEND_BIND_REF) {
/* By-ref binding */
var = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
@@ -20324,17 +19465,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_LEXICAL_SPEC_TMP_CV_HANDL
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20358,17 +19491,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_help
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_increment_function(var_ptr);
@@ -20384,10 +19516,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_R
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_increment_function(var_ptr);
@@ -20403,17 +19534,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_R
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20438,17 +19561,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_help
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_decrement_function(var_ptr);
@@ -20464,10 +19586,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_R
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_decrement_function(var_ptr);
@@ -20483,15 +19604,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_R
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20514,17 +19629,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_hel
increment_function(var_ptr);
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_LVAL_P(var_ptr));
@@ -20538,15 +19652,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20569,17 +19677,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_hel
decrement_function(var_ptr);
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_LVAL_P(var_ptr));
@@ -20595,9 +19702,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -20607,9 +19713,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
}
} else if (!return_value) {
if (IS_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -20663,7 +19769,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -20673,9 +19778,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
/* Not supposed to happen, but we'll allow it */
zend_error(E_NOTICE, "Only variable references should be returned by reference");
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (!EX(return_value)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
@@ -20690,7 +19795,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
break;
}
- retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
ZEND_ASSERT(retval_ptr != &EG(uninitialized_zval));
@@ -20699,7 +19804,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
if (EX(return_value)) {
ZVAL_NEW_REF(EX(return_value), retval_ptr);
} else {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
break;
}
@@ -20714,7 +19819,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} while (0);
ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -20724,12 +19829,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_VAR_HAND
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
- retval = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Copy return value into generator->retval */
if ((IS_VAR & (IS_CONST|IS_TMP_VAR))) {
@@ -20764,53 +19868,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_VAR_HAND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zval *value;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- do {
- if (IS_VAR == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
- if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
- break;
- }
- }
- if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP1();
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- }
- zend_throw_error(NULL, "Can only throw objects");
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
- }
- } while (0);
-
- zend_exception_save();
- if (IS_VAR != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
- zend_throw_exception_object(value);
- zend_exception_restore();
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
-}
-
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -20850,10 +19913,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20870,7 +19932,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -20879,7 +19940,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20892,7 +19953,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20911,7 +19972,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_QUICK_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -20920,7 +19980,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20933,7 +19993,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20952,19 +20012,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
SAVE_OPLINE();
- varptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -20972,7 +20025,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND
}
ZVAL_REF(arg, Z_REF_P(varptr));
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -20980,7 +20033,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_VAR_HANDLER(Z
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -20992,7 +20044,7 @@ send_var_by_ref:
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21028,7 +20080,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_V
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -21040,7 +20091,7 @@ send_var_by_ref:
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21076,13 +20127,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_FUNC_ARG_SPEC
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
if (UNEXPECTED(ZEND_CALL_INFO(EX(call)) & ZEND_CALL_SEND_ARG_BY_REF)) {
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (UNEXPECTED(Z_ISREF_P(varptr))) {
@@ -21106,7 +20156,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -21114,23 +20163,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN
zend_param_must_be_ref(EX(call)->func, opline->op2.num);
}
- arg = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ arg = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY(param, arg);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
switch (opline->extended_value) {
case IS_NULL:
@@ -21161,7 +20209,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
if (Z_OPT_REFCOUNTED_P(result)) Z_ADDREF_P(result);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -21212,19 +20260,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
}
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
- array_ptr = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ptr = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
@@ -21233,30 +20280,37 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
}
Z_FE_POS_P(result) = 0;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
} else if (is_empty) {
@@ -21269,7 +20323,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
}
@@ -21277,18 +20331,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- array_ref = array_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(array_ref)) {
array_ptr = Z_REFVAL_P(array_ref);
}
} else {
- array_ref = array_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
}
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
@@ -21312,7 +20365,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
@@ -21337,15 +20390,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -21360,9 +20413,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
@@ -21703,13 +20756,12 @@ fe_fetch_w_exit:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(value)) {
if (IS_VAR == IS_VAR) {
@@ -21721,7 +20773,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_
ret = i_zend_is_true(value);
if (UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -21746,19 +20798,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
if (IS_VAR & IS_VAR) {
@@ -21786,18 +20837,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_VAR_HANDLER(ZEND
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21829,120 +20879,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR
ZEND_VM_NEXT_OPCODE();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- zval *val;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- val = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
- zval_ptr_dtor_nogc(free_op1);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (Z_TYPE_P(val) == IS_ARRAY) {
- ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_VAR != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- Z_FE_POS(generator->values) = 0;
-
- zval_ptr_dtor_nogc(free_op1);
- } else if (IS_VAR != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
- zend_class_entry *ce = Z_OBJCE_P(val);
- if (ce == zend_ce_generator) {
- zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
-
- if (IS_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
- zval_ptr_dtor_nogc(free_op1);
-
- if (Z_ISUNDEF(new_gen->retval)) {
- if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
- zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- zend_generator_yield_from(generator, new_gen);
- }
- } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
- zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
- }
- ZEND_VM_NEXT_OPCODE();
- }
- } else {
- zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
- zval_ptr_dtor_nogc(free_op1);
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (!EG(exception)) {
- zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
- }
-
- ZVAL_OBJ(&generator->values, &iter->std);
- }
- } else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- /* This is the default return value
- * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
-
- /* This generator has no send target (though the generator we delegate to might have one) */
- generator->send_target = NULL;
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SIMPLE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (IS_VAR == IS_CV) {
@@ -21958,14 +20900,13 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (IS_VAR == IS_CV) {
@@ -21980,52 +20921,47 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22034,7 +20970,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_H
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -22045,16 +20981,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -22091,13 +21035,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22106,12 +21053,11 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -22135,7 +21081,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CONST != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -22152,7 +21098,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -22183,59 +21129,53 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22253,16 +21193,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -22276,26 +21224,30 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22313,16 +21265,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -22335,27 +21295,28 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22363,16 +21324,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22399,16 +21358,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_UNSET(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22416,12 +21373,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
@@ -22434,7 +21390,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HAN
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22442,11 +21398,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22456,7 +21411,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HA
zend_fetch_property_address(result, container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22481,11 +21436,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22496,7 +21450,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST
zend_fetch_property_address(result, container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22504,11 +21458,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if (IS_VAR == IS_VAR
@@ -22527,11 +21480,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22545,16 +21499,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22638,7 +21591,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -22647,7 +21615,7 @@ exit_assign_obj:
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22656,34 +21624,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22767,16 +21735,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22785,34 +21768,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22896,16 +21879,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22914,11 +21912,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -22932,16 +21931,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -23025,7 +22023,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -23034,7 +22047,7 @@ exit_assign_obj:
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23043,15 +22056,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -23071,11 +22082,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -23137,9 +22149,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -23151,7 +22161,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23159,27 +22169,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -23187,6 +22195,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -23208,7 +22217,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -23223,14 +22232,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -23238,9 +22247,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -23254,9 +22263,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -23268,7 +22275,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23276,27 +22283,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -23304,6 +22309,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -23325,7 +22331,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -23340,14 +22346,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -23355,9 +22361,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -23371,9 +22377,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -23385,7 +22389,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23393,15 +22397,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -23421,11 +22423,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -23487,9 +22490,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -23501,7 +22502,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23509,27 +22510,19 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -23537,27 +22530,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_U
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -23565,12 +22550,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_U
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -23578,7 +22562,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -23598,9 +22582,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CONST, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23608,12 +22592,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -23641,7 +22624,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CONST, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -23693,8 +22676,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -23730,7 +22711,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -23761,13 +22741,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -23863,21 +22839,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -23902,7 +22877,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CON
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -23982,14 +22956,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
do {
@@ -24040,7 +23013,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -24059,25 +23032,25 @@ num_index_dim:
if (IS_CONST == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
@@ -24098,10 +23071,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24124,8 +23108,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -24134,7 +23116,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -24142,7 +23124,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -24164,10 +23146,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -24179,7 +23161,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -24194,26 +23176,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -24249,13 +23216,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
result = zend_hash_find_ex(ht, Z_STR_P(op1), IS_VAR == IS_CONST);
} else if (opline->extended_value) {
@@ -24268,46 +23234,44 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_VAR_CONST_HANDLE
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
} ZEND_HASH_FOREACH_END();
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -24318,16 +23282,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_TMPVAR_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -24364,13 +23336,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -24379,18 +23354,17 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
SEPARATE_ARRAY(container);
assign_dim_op_new_array:
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(!var_ptr)) {
@@ -24408,7 +23382,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -24425,7 +23399,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -24434,7 +23408,7 @@ assign_dim_op_new_array:
}
}
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -24456,67 +23430,61 @@ assign_dim_op_ret_null:
}
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24528,16 +23496,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -24551,33 +23527,37 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24589,16 +23569,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -24611,28 +23599,29 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24640,16 +23629,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24676,16 +23663,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24693,25 +23678,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24719,21 +23703,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24758,22 +23741,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24781,12 +23763,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR
&& Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT
@@ -24798,24 +23779,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_TMPVAR_H
zend_fetch_dimension_address_W(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24823,16 +23805,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -24916,7 +23897,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -24924,8 +23920,8 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -24934,34 +23930,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25045,16 +24041,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25063,34 +24074,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25174,16 +24185,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25192,17 +24218,18 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -25210,16 +24237,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25303,7 +24329,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -25311,8 +24352,8 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25321,15 +24362,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -25349,11 +24388,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -25361,7 +24401,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25384,7 +24424,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -25398,7 +24438,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -25407,7 +24447,7 @@ try_assign_dim_array:
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -25415,10 +24455,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25427,9 +24465,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25437,27 +24475,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -25465,6 +24501,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -25477,7 +24514,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25486,7 +24523,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25500,31 +24537,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -25532,10 +24569,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25544,9 +24579,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25554,27 +24589,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -25582,6 +24615,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -25594,7 +24628,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25603,7 +24637,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25617,31 +24651,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -25649,10 +24683,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25661,9 +24693,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25671,15 +24703,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -25699,11 +24729,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -25711,7 +24742,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25734,7 +24765,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -25748,7 +24779,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -25757,7 +24788,7 @@ try_assign_dim_array:
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -25765,10 +24796,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25777,9 +24806,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25787,20 +24816,19 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -25820,9 +24848,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
zend_assign_to_property_reference(container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25830,18 +24858,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -25863,8 +24890,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
zend_assign_to_property_reference(container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25915,9 +24942,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -25933,7 +24958,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
}
}
zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -25948,11 +24973,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -25960,7 +24984,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -25983,13 +25007,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -26014,21 +25034,20 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -26053,8 +25072,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -26099,7 +25117,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -26133,15 +25151,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -26191,7 +25208,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -26210,30 +25227,30 @@ num_index_dim:
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -26250,107 +25267,26 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HAND
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
- } while (0);
-
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
}
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
+ } while (0);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -26369,8 +25305,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -26379,7 +25313,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -26387,7 +25321,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -26409,10 +25343,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -26424,7 +25358,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -26438,27 +25372,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -26491,66 +25411,122 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26558,27 +25534,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_UNU
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26586,23 +25554,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_USE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
- value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR &&
+ if (IS_VAR == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_VAR == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -26618,161 +25581,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLE
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_VAR & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_VAR == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- }
- } else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -26796,7 +25617,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -26813,7 +25634,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -26844,23 +25665,21 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26868,16 +25687,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26904,15 +25721,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -26932,11 +25747,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -26998,9 +25814,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -27012,7 +25826,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27020,27 +25834,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -27048,6 +25860,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -27069,7 +25882,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -27084,14 +25897,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -27099,9 +25912,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -27115,9 +25928,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -27129,7 +25940,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27137,27 +25948,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -27165,6 +25974,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -27186,7 +25996,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -27201,14 +26011,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -27216,9 +26026,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -27232,9 +26042,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -27246,7 +26054,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27254,15 +26062,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -27282,11 +26088,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -27348,9 +26155,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -27362,7 +26167,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27412,8 +26217,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -27449,7 +26252,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -27480,13 +26282,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -27519,10 +26317,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
/* prevents "undefined variable opline" errors */
#if 0 || (IS_VAR != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
- retval_ref = retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ref = retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CONST) {
ZVAL_COPY(EX_VAR(opline->result.var), retval_ptr);
@@ -27537,9 +26334,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -27632,21 +26428,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_VAR_UNUSED_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -27671,7 +26466,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNU
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -27782,8 +26576,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -27792,7 +26584,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -27800,7 +26592,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -27822,10 +26614,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -27837,7 +26629,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -27852,26 +26644,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -27940,35 +26717,35 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MAKE_REF_SPEC_VAR_UNUSED_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
type = zend_zval_get_type(op1);
if (EXPECTED(type)) {
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
} else {
ZVAL_STRING(EX_VAR(opline->result.var), "unknown type");
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -27977,7 +26754,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HAND
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -27988,16 +26765,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -28034,13 +26819,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28049,12 +26837,11 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -28078,7 +26865,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -28095,7 +26882,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -28126,59 +26913,53 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28196,16 +26977,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -28219,26 +27008,30 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28256,16 +27049,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -28278,27 +27079,28 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28306,16 +27108,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28342,16 +27142,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_UNSET(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28359,12 +27157,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
@@ -28377,7 +27174,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLE
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28385,11 +27182,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28399,7 +27195,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDL
zend_fetch_property_address(result, container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28424,11 +27220,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28439,7 +27234,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HA
zend_fetch_property_address(result, container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28447,11 +27242,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if (IS_VAR == IS_VAR
@@ -28470,11 +27264,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28488,16 +27283,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28581,7 +27375,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -28590,7 +27399,7 @@ exit_assign_obj:
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28599,34 +27408,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28710,16 +27519,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28728,34 +27552,34 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28839,16 +27663,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28857,11 +27696,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -28875,16 +27715,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28968,7 +27807,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -28977,7 +27831,7 @@ exit_assign_obj:
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28986,15 +27840,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -29014,11 +27866,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -29080,9 +27933,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -29094,7 +27945,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29102,27 +27953,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -29130,6 +27979,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -29151,7 +28001,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -29166,14 +28016,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -29181,9 +28031,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -29197,9 +28047,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -29211,7 +28059,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29219,27 +28067,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -29247,6 +28093,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -29268,7 +28115,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -29283,14 +28130,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -29298,9 +28145,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -29314,9 +28161,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -29328,7 +28173,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29336,15 +28181,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -29364,11 +28207,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -29430,9 +28274,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -29444,7 +28286,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29452,27 +28294,19 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -29480,27 +28314,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_UNUS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -29508,23 +28334,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_USED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR &&
+ if (IS_VAR == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_CV == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -29540,19 +28361,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -29560,7 +28380,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -29580,9 +28400,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CV, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29590,12 +28410,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -29623,7 +28442,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CV, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -29675,8 +28494,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -29712,7 +28529,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -29743,13 +28559,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -29774,21 +28586,20 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -29813,7 +28624,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -29893,14 +28703,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = EX_VAR(opline->op2.var);
do {
@@ -29951,7 +28760,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -29970,25 +28779,25 @@ num_index_dim:
if (IS_CV == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
@@ -30009,10 +28818,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30035,8 +28855,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -30045,7 +28863,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -30053,7 +28871,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -30075,10 +28893,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -30090,7 +28908,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -30105,26 +28923,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -30302,8 +29105,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CHECK_FUNC_ARG_SPE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -30337,9 +29140,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -30360,7 +29164,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30413,13 +29217,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_UNUSED_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -30431,7 +29236,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONS
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -30442,16 +29247,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONS
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -30488,11 +29301,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -30503,12 +29319,13 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -30529,16 +29346,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -30552,7 +29377,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -30563,12 +29391,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -30589,16 +29418,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -30611,7 +29448,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -30622,9 +29462,7 @@ post_incdec_object:
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -30661,9 +29499,11 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -30688,10 +29528,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -30702,7 +29542,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30714,11 +29554,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -30742,7 +29593,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -30760,7 +29610,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30768,7 +29618,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -30782,7 +29631,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30790,9 +29639,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -30822,9 +29669,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -30849,10 +29698,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -30863,7 +29712,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30875,9 +29724,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -30913,7 +29772,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -30928,7 +29786,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CO
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30936,8 +29794,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -30954,16 +29813,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31047,7 +29905,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -31065,8 +29938,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -31076,23 +29950,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31176,10 +30049,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -31194,8 +30082,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -31205,23 +30094,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31305,10 +30193,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -31323,8 +30226,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -31341,16 +30245,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31434,7 +30337,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -31452,7 +30370,6 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -31465,7 +30382,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -31486,7 +30403,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -31494,7 +30411,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -31536,7 +30452,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -31571,7 +30486,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -31616,7 +30530,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -31711,7 +30624,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -31741,9 +30653,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -31802,8 +30717,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -31839,7 +30752,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -31870,13 +30782,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -32009,9 +30917,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
@@ -32035,7 +30943,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HA
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -32045,10 +30964,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
@@ -32073,16 +30992,28 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -32104,8 +31035,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -32173,26 +31102,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -32228,13 +31142,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -32243,10 +31158,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPV
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -32257,16 +31172,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPV
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -32303,12 +31226,15 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -32318,12 +31244,13 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -32332,7 +31259,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32344,16 +31271,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -32367,11 +31302,14 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32379,12 +31317,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -32393,7 +31332,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVA
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32405,16 +31344,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -32427,11 +31374,14 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32439,9 +31389,7 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -32452,7 +31400,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -32478,9 +31426,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -32505,10 +31455,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -32519,7 +31469,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32531,11 +31481,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -32546,7 +31507,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32554,7 +31515,6 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -32564,15 +31524,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32580,7 +31540,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -32589,12 +31548,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVA
if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32602,9 +31561,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -32615,7 +31572,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -32634,9 +31591,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -32661,10 +31620,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -32675,7 +31634,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32687,9 +31646,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -32700,7 +31669,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32725,7 +31694,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -32735,12 +31703,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TM
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32748,8 +31716,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -32758,7 +31727,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32766,16 +31735,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -32859,7 +31827,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -32867,7 +31850,7 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -32877,8 +31860,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -32887,24 +31871,23 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -32988,15 +31971,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33006,8 +32004,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -33016,24 +32015,23 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -33117,15 +32115,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33135,8 +32148,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -33145,7 +32159,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -33153,16 +32167,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -33246,7 +32259,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -33254,7 +32282,7 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33264,7 +32292,6 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -33275,9 +32302,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -33297,8 +32324,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
zend_assign_to_property_reference(container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -33306,7 +32333,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -33317,7 +32343,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -33339,7 +32365,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
zend_assign_to_property_reference(container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -33348,20 +32374,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
/* Compiler allocates the necessary number of zval slots to keep the rope */
rope = (zend_string**)EX_VAR(opline->result.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[0] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[0] = zend_string_copy(Z_STR_P(var));
@@ -33374,7 +32399,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_H
ZVAL_UNDEFINED_OP2();
}
rope[0] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -33383,7 +32408,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
- zend_free_op free_op2;
zval *class_name;
USE_OPLINE
@@ -33395,13 +32419,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR
zend_class_entry *ce = CACHED_PTR(opline->extended_value);
if (UNEXPECTED(ce == NULL)) {
- class_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ class_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
ce = zend_fetch_class_by_name(Z_STR_P(class_name), Z_STR_P(class_name + 1), opline->op1.num);
CACHE_PTR(opline->extended_value, ce);
}
Z_CE_P(EX_VAR(opline->result.var)) = ce;
} else {
- class_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ class_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
try_class_name:
if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -33421,7 +32445,7 @@ try_class_name:
}
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -33429,7 +32453,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -33446,7 +32469,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -33465,7 +32488,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -33484,16 +32507,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -33510,7 +32533,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -33519,12 +32542,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -33539,7 +32561,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -33554,9 +32576,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -33615,9 +32640,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -33633,7 +32656,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
}
}
zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -33648,11 +32671,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -33660,7 +32682,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -33683,13 +32705,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -33735,16 +32753,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -33761,10 +32779,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_H
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -33772,10 +32801,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
@@ -33784,7 +32813,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -33800,159 +32829,31 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
- result =
- (opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
-
-isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
-
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_UNUSED != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_UNUSED & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = NULL;
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_UNUSED == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_UNUSED == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
} else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
}
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
+ result =
+ (opline->extended_value & ZEND_ISEMPTY) ^
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
+isset_object_finish:
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
- ZEND_VM_RETURN();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -33971,8 +32872,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -34039,27 +32938,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
}
/* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -34094,7 +32979,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -34180,8 +33064,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -34217,7 +33099,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -34248,13 +33129,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -34287,7 +33164,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
/* prevents "undefined variable opline" errors */
#if 0 || (IS_UNUSED != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
retval_ref = retval_ptr = NULL;
@@ -34305,9 +33181,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -34437,8 +33312,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -34506,26 +33379,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -34598,7 +33456,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_UNUSED_UNUSED_H
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -34613,8 +33470,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_UNUSED_UNUSED_H
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -34728,13 +33585,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_UNUSED_UNUS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -34746,7 +33604,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_H
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -34757,16 +33615,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -34803,11 +33669,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -34818,12 +33687,13 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -34844,16 +33714,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -34867,7 +33745,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -34878,12 +33759,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -34904,16 +33786,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -34926,7 +33816,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -34937,9 +33830,7 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -34976,9 +33867,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -35003,10 +33896,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -35017,7 +33910,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -35029,11 +33922,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -35052,7 +33956,6 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -35070,7 +33973,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HAN
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35078,7 +33981,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -35092,7 +33994,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HA
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35100,9 +34002,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -35132,9 +34032,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -35159,10 +34061,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -35173,7 +34075,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -35185,9 +34087,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -35223,7 +34135,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -35238,7 +34149,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35246,8 +34157,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -35264,16 +34176,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35357,7 +34268,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -35375,8 +34301,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -35386,23 +34313,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35486,10 +34412,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -35504,8 +34445,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -35515,23 +34457,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35615,10 +34556,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -35633,8 +34589,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
@@ -35651,16 +34608,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35744,7 +34700,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -35762,7 +34733,6 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -35775,7 +34745,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -35796,7 +34766,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -35804,7 +34774,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -35846,7 +34815,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -35881,7 +34849,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -35926,7 +34893,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -36021,7 +34987,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -36051,9 +35016,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -36112,8 +35080,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -36149,7 +35115,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -36180,13 +35145,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -36232,9 +35193,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
@@ -36258,7 +35219,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -36268,10 +35240,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
@@ -36296,16 +35268,28 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -36327,8 +35311,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -36396,26 +35378,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -36451,7 +35418,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
op1 = EX_VAR(opline->op1.var);
@@ -36474,7 +35440,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_
USE_OPLINE
zval *val;
-
val = EX_VAR(opline->op1.var);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -36497,18 +35462,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36537,7 +35494,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_help
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36556,7 +35512,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36575,18 +35530,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RE
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36616,7 +35563,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_help
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36635,7 +35581,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36654,16 +35599,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RE
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36691,7 +35630,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_hel
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36708,16 +35646,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_H
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36745,7 +35677,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_hel
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36762,7 +35693,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *z;
SAVE_OPLINE();
@@ -36791,8 +35721,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCO
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -36810,20 +35740,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDL
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -36841,20 +35774,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HAND
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -36873,19 +35809,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OP
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -36922,7 +35860,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -36960,7 +35897,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = EX_VAR(opline->op1.var);
return_value = EX(return_value);
@@ -36972,9 +35908,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
}
} else if (!return_value) {
if (IS_CV & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -37029,7 +35965,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(
USE_OPLINE
zval *retval_ptr;
-
SAVE_OPLINE();
do {
@@ -37089,7 +36024,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_CV_HANDL
USE_OPLINE
zval *retval;
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
@@ -37133,7 +36067,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPC
USE_OPLINE
zval *value;
-
SAVE_OPLINE();
value = EX_VAR(opline->op1.var);
@@ -37158,10 +36091,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPC
} while (0);
zend_exception_save();
- if (IS_CV != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
@@ -37173,7 +36103,6 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SP
USE_OPLINE
zval *varptr, *arg;
-
varptr = EX_VAR(opline->op1.var);
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -37214,19 +36143,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *varptr, *arg;
SAVE_OPLINE();
varptr = _get_zval_ptr_cv_BP_VAR_W(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -37241,7 +36163,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_CV_HANDLER(ZE
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -37289,7 +36210,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_C
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -37338,7 +36258,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND
USE_OPLINE
zval *arg, *param;
-
SAVE_OPLINE();
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
@@ -37357,7 +36276,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCO
USE_OPLINE
zval *val;
-
val = EX_VAR(opline->op1.var);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -37380,8 +36298,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -37415,9 +36333,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -37438,7 +36357,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -37446,7 +36365,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -37540,7 +36458,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE
{
USE_OPLINE
zend_op_array *new_op_array;
-
zval *inc_filename;
SAVE_OPLINE();
@@ -37605,7 +36522,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -37621,20 +36537,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
ZEND_VM_NEXT_OPCODE();
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_CV != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -37660,7 +36583,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -37753,7 +36675,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
int ret;
@@ -37802,7 +36723,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
@@ -37841,7 +36761,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CV_HANDLER(ZEND_
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -37880,14 +36799,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
-
SAVE_OPLINE();
- val = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ val = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
@@ -37896,9 +36812,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
HANDLE_EXCEPTION();
}
+yield_from_try_again:
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_CV != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
@@ -37908,9 +36825,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (IS_CV != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
+ Z_ADDREF_P(val);
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -37955,6 +36870,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -37986,7 +36904,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OP
USE_OPLINE
zval *value;
-
value = EX_VAR(opline->op1.var);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
@@ -38023,9 +36940,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OP
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
@@ -38038,7 +36955,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV
zval *value;
int result = 0;
-
value = EX_VAR(opline->op1.var);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
@@ -38064,12 +36980,8 @@ type_check_resource:
SAVE_OPLINE();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
@@ -38226,7 +37138,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SIMPLE_SP
USE_OPLINE
zval *varptr, *arg;
-
varptr = EX_VAR(opline->op1.var);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -38243,7 +37154,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -38265,7 +37175,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38280,7 +37189,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38295,7 +37203,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CONST_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -38367,7 +37274,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -38378,14 +37284,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HAN
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -38396,14 +37299,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38415,14 +37315,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38466,7 +37362,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38479,13 +37374,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPZ_HA
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38529,7 +37420,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38542,13 +37432,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPNZ_H
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38592,7 +37478,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38604,14 +37489,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HAN
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38655,7 +37536,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38668,13 +37548,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38718,7 +37594,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38731,13 +37606,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38781,7 +37652,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38796,7 +37666,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38811,13 +37680,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -38829,7 +37699,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HA
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -38840,16 +37710,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -38886,11 +37764,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -38901,7 +37782,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -38930,7 +37810,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CONST != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -38947,7 +37827,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -38985,7 +37865,6 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
zval *value;
@@ -38993,26 +37872,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLE
value = RT_CONSTANT(opline, opline->op2);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
@@ -39022,12 +37895,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39048,16 +37922,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -39071,7 +37953,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -39082,12 +37967,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39108,16 +37994,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -39130,7 +38024,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -39141,7 +38038,6 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -39177,7 +38073,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39185,8 +38080,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HAND
zend_fetch_dimension_address_W(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39194,7 +38088,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39202,8 +38095,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HAN
zend_fetch_dimension_address_RW(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39211,7 +38103,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -39244,7 +38135,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39252,8 +38142,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_
zend_fetch_dimension_address_UNSET(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39261,9 +38150,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -39300,9 +38187,11 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -39327,10 +38216,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -39341,7 +38230,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -39353,11 +38242,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -39381,7 +38281,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -39399,7 +38298,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HAND
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39407,7 +38306,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -39421,7 +38319,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HAN
zend_fetch_property_address(result, container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39429,9 +38327,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -39461,9 +38357,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -39488,10 +38386,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -39502,7 +38400,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -39514,9 +38412,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -39552,7 +38460,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -39567,7 +38474,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_
zend_fetch_property_address(result, container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39575,8 +38482,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39593,16 +38501,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -39686,7 +38593,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -39704,8 +38626,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39715,23 +38638,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -39815,10 +38737,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -39833,8 +38770,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39844,23 +38782,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
}
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -39944,10 +38881,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -39962,8 +38914,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -39980,16 +38933,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -40073,7 +39025,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -40091,9 +39058,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40119,11 +39084,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -40185,9 +39151,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -40207,9 +39171,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40221,13 +39183,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -40235,6 +39197,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -40256,7 +39219,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -40271,14 +39234,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -40286,9 +39249,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -40302,9 +39265,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -40324,9 +39285,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40338,13 +39297,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -40352,6 +39311,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -40373,7 +39333,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -40388,14 +39348,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -40403,9 +39363,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -40419,9 +39379,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -40441,9 +39399,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40469,11 +39425,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -40535,9 +39492,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -40557,7 +39512,6 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -40565,27 +39519,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_UN
value = RT_CONSTANT(opline, opline->op2);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -40593,27 +39539,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_US
value = RT_CONSTANT(opline, opline->op2);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -40626,7 +39564,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -40647,7 +39585,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -40655,7 +39593,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -40697,7 +39634,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -40819,7 +39755,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -40914,7 +39849,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -40944,9 +39878,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -40963,7 +39900,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -41002,7 +39938,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONS
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -41082,7 +40017,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
zend_ulong hval;
@@ -41140,7 +40074,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -41159,7 +40093,7 @@ num_index_dim:
if (IS_CONST == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -41172,9 +40106,9 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
@@ -41198,7 +40132,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLE
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -41208,7 +40153,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -41243,6 +40187,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -41254,8 +40202,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -41281,17 +40227,15 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
@@ -41316,23 +40260,34 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -41358,15 +40313,12 @@ array_key_exists_array:
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -41408,8 +40360,6 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -41431,8 +40381,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -41500,26 +40448,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -41555,7 +40488,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_GLOBAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string *varname;
zval *value;
zval *variable_ptr;
@@ -41638,7 +40570,6 @@ check_indirect:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -41657,13 +40588,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -41671,14 +40601,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -41731,7 +40658,6 @@ fetch_dim_r_index_undef:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -41784,41 +40710,38 @@ fetch_dim_r_index_undef:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -41878,7 +40801,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -41886,26 +40809,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -41949,12 +40867,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -41962,13 +40879,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPZ_H
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42012,12 +40925,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42025,13 +40937,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPNZ_
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42075,26 +40983,21 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42138,12 +41041,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42151,13 +41053,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42201,12 +41099,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42214,13 +41111,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42264,43 +41157,42 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -42309,10 +41201,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_H
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -42323,16 +41215,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -42369,12 +41269,15 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -42384,7 +41287,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -42395,7 +41297,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H
assign_dim_op_array:
SEPARATE_ARRAY(container);
assign_dim_op_new_array:
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(!var_ptr)) {
@@ -42413,7 +41315,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -42430,7 +41332,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -42439,7 +41341,7 @@ assign_dim_op_new_array:
}
}
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -42461,7 +41363,7 @@ assign_dim_op_ret_null:
}
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -42469,37 +41371,30 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42507,12 +41402,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -42521,7 +41417,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HAN
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -42533,16 +41429,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -42556,11 +41460,14 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42568,12 +41475,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -42582,7 +41490,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HA
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -42594,16 +41502,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -42616,11 +41532,14 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42628,12 +41547,11 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -42656,7 +41574,7 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42664,16 +41582,14 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42681,16 +41597,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42698,13 +41612,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42731,16 +41644,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42748,9 +41659,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -42761,7 +41670,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -42787,9 +41696,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -42814,10 +41725,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -42828,7 +41739,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -42840,11 +41751,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -42855,7 +41777,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42863,7 +41785,6 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -42873,15 +41794,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HAN
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42889,7 +41810,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -42898,12 +41818,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HA
if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42911,9 +41831,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
@@ -42924,7 +41842,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -42943,9 +41861,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -42970,10 +41890,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -42984,7 +41904,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -42996,9 +41916,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -43009,7 +41939,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43034,7 +41964,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -43044,12 +41973,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43057,8 +41986,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -43067,7 +41997,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -43075,16 +42005,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43168,7 +42097,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -43176,7 +42120,7 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43186,8 +42130,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -43196,24 +42141,23 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43297,15 +42241,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43315,8 +42274,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -43325,24 +42285,23 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43426,15 +42385,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43444,8 +42418,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -43454,7 +42429,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -43462,16 +42437,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43555,7 +42529,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -43563,7 +42552,7 @@ exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43573,9 +42562,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43601,11 +42588,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -43613,7 +42601,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43636,7 +42624,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -43650,7 +42638,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -43659,7 +42647,7 @@ try_assign_dim_array:
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -43667,10 +42655,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43679,7 +42665,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -43689,9 +42675,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43703,13 +42687,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -43717,6 +42701,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -43729,7 +42714,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43738,7 +42723,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43752,31 +42737,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -43784,10 +42769,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43796,7 +42779,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -43806,9 +42789,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43820,13 +42801,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -43834,6 +42815,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -43846,7 +42828,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43855,7 +42837,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43869,31 +42851,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -43901,10 +42883,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43913,7 +42893,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -43923,9 +42903,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43951,11 +42929,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -43963,7 +42942,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43986,7 +42965,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -44000,7 +42979,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -44009,7 +42988,7 @@ try_assign_dim_array:
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))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -44017,10 +42996,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -44029,7 +43006,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -44039,7 +43016,6 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -44050,9 +43026,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -44072,8 +43048,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
zend_assign_to_property_reference(container, IS_CV, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -44081,7 +43057,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -44092,7 +43067,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -44114,7 +43089,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
zend_assign_to_property_reference(container, IS_CV, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -44123,13 +43098,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -44237,7 +43211,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HAN
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44245,7 +43219,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -44262,7 +43235,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -44281,7 +43254,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -44300,16 +43273,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -44326,7 +43299,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -44335,12 +43308,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -44355,7 +43327,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -44370,9 +43342,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -44389,7 +43364,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -44428,8 +43402,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMPV
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -44474,7 +43447,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -44508,7 +43481,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMPVAR_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
zend_ulong hval;
@@ -44516,7 +43488,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -44566,7 +43538,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -44585,13 +43557,13 @@ num_index_dim:
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44599,16 +43571,16 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -44625,10 +43597,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44636,7 +43619,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -44644,7 +43626,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -44671,6 +43653,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -44680,10 +43666,8 @@ num_index_prop:
if (IS_CV & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -44706,20 +43690,18 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
@@ -44728,7 +43710,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -44744,23 +43726,34 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -44768,7 +43761,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVA
SAVE_OPLINE();
key = EX_VAR(opline->op1.var);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -44784,107 +43777,13 @@ array_key_exists_array:
result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
-
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
-
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -44903,8 +43802,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -44971,27 +43868,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -45024,118 +43907,161 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = EX_VAR(opline->op1.var);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = EX_VAR(opline->op1.var);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
- value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR &&
+ if (IS_CV == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_VAR == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -45151,7 +44077,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45159,7 +44085,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -45201,154 +44126,11 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_CV != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_CV & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CV == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op1.var EXECUTE_DATA_CC);
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_CV == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -45377,7 +44159,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -45394,7 +44176,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -45432,7 +44214,6 @@ assign_dim_op_ret_null:
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
-
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -45474,7 +44255,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -45493,7 +44274,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -45557,7 +44338,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -45565,8 +44345,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HAN
zend_fetch_dimension_address_W(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45574,7 +44353,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -45582,8 +44360,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HA
zend_fetch_dimension_address_RW(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45610,9 +44387,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNU
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45638,11 +44413,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -45704,9 +44480,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -45726,9 +44500,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45740,13 +44512,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -45754,6 +44526,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -45775,7 +44548,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -45790,14 +44563,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -45805,9 +44578,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -45821,9 +44594,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -45843,9 +44614,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45857,13 +44626,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -45871,6 +44640,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -45892,7 +44662,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -45907,14 +44677,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -45922,9 +44692,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -45938,9 +44708,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -45960,9 +44728,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45988,11 +44754,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -46054,9 +44821,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -46084,7 +44849,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
/* prevents "undefined variable opline" errors */
#if 0 || (IS_CV != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
retval_ref = retval_ptr = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
@@ -46102,9 +44866,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
}
if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
+ && !(ZEND_TYPE_MASK(ret_info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE))
+ && !ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr))
&& !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
&& retval_ref != retval_ptr)
) {
@@ -46126,7 +44889,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -46165,7 +44927,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUS
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -46271,7 +45032,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDL
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
-
SAVE_OPLINE();
varname = EX_VAR(opline->op1.var);
@@ -46313,25 +45073,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -46345,25 +45095,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -46372,7 +45112,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS
USE_OPLINE
zval *value;
int result;
-
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -46409,15 +45148,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -46459,8 +45195,6 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -46482,8 +45216,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -46551,26 +45283,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -46606,7 +45323,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
HashTable *ht;
zval *value;
zval *variable_ptr;
@@ -46706,7 +45422,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MAKE_REF_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_long count;
@@ -46717,9 +45432,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -46729,10 +45446,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (instanceof_function(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -46775,7 +45492,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -46790,8 +45506,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -46803,7 +45519,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_string *type;
@@ -46822,7 +45537,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -46837,7 +45551,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -46852,7 +45565,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CV_HANDLER(ZEND_OP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -46924,7 +45636,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -46935,14 +45646,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLE
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -46953,14 +45661,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HA
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -46972,14 +45677,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZE
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47023,7 +45724,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47036,13 +45736,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPZ_HANDL
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47086,7 +45782,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47099,13 +45794,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPNZ_HAND
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47149,7 +45840,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47161,14 +45851,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLE
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47212,7 +45898,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47225,13 +45910,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPZ_H
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47275,7 +45956,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47288,13 +45968,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPNZ_
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47338,7 +46014,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47353,7 +46028,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47368,13 +46042,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -47386,7 +46061,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDL
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -47397,16 +46072,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -47443,11 +46126,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -47458,7 +46144,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -47487,7 +46172,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -47504,7 +46189,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -47542,7 +46227,6 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
zval *value;
@@ -47550,26 +46234,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(Z
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
- var_ptr = Z_REFVAL_P(var_ptr);
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
@@ -47579,12 +46257,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -47605,16 +46284,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -47628,7 +46315,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -47639,12 +46329,13 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -47665,16 +46356,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -47687,7 +46386,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -47698,7 +46400,6 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -47734,7 +46435,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -47742,8 +46442,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER
zend_fetch_dimension_address_W(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47751,7 +46450,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -47759,8 +46457,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLE
zend_fetch_dimension_address_RW(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47768,7 +46465,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -47801,7 +46497,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -47809,8 +46504,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HAN
zend_fetch_dimension_address_UNSET(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47818,9 +46512,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -47857,9 +46549,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -47884,10 +46578,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -47898,7 +46592,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -47910,11 +46604,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -47933,7 +46638,6 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -47951,7 +46655,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47959,7 +46663,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
@@ -47973,7 +46676,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLE
zend_fetch_property_address(result, container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47981,9 +46684,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
@@ -48013,9 +46714,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLE
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -48040,10 +46743,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -48054,7 +46757,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -48066,9 +46769,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -48104,7 +46817,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
@@ -48119,7 +46831,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HAN
zend_fetch_property_address(result, container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48127,8 +46839,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -48145,16 +46858,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48238,7 +46950,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -48256,8 +46983,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -48267,23 +46995,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48367,10 +47094,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -48385,8 +47127,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -48396,23 +47139,22 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
}
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48496,10 +47238,25 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -48514,8 +47271,9 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
@@ -48532,16 +47290,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48625,7 +47382,22 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
@@ -48643,9 +47415,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -48671,11 +47441,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -48737,9 +47508,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -48759,9 +47528,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -48773,13 +47540,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -48787,6 +47554,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -48808,7 +47576,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -48823,14 +47591,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -48838,9 +47606,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -48854,9 +47622,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -48876,9 +47642,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -48890,13 +47654,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -48904,6 +47668,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -48925,7 +47690,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -48940,14 +47705,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -48955,9 +47720,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -48971,9 +47736,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -48993,9 +47756,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -49021,11 +47782,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -49087,9 +47849,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -49109,7 +47869,6 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -49117,27 +47876,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_UNUSE
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -49145,27 +47896,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_USED_
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *variable_ptr;
zval *value_ptr;
@@ -49173,15 +47916,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR &&
+ if (IS_CV == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_CV == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -49204,7 +47943,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -49217,7 +47955,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -49238,7 +47976,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -49246,7 +47984,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
@@ -49288,7 +48025,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -49410,7 +48146,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -49505,7 +48240,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -49535,9 +48269,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -49554,7 +48291,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -49593,7 +48329,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_H
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -49673,7 +48408,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
zend_ulong hval;
@@ -49731,7 +48465,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -49750,7 +48484,7 @@ num_index_dim:
if (IS_CV == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -49763,9 +48497,9 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
@@ -49789,7 +48523,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(Z
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -49799,7 +48544,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -49834,6 +48578,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -49845,8 +48593,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -49872,17 +48618,15 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
@@ -49907,23 +48651,34 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
uint32_t result;
@@ -49949,8 +48704,6 @@ array_key_exists_array:
ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -49973,8 +48726,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -50042,26 +48793,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -51998,8 +50734,8 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_SEND_VAR_NO_REF_SPEC_VAR_LABEL,
(void*)&&ZEND_CATCH_SPEC_CONST_LABEL,
(void*)&&ZEND_THROW_SPEC_CONST_LABEL,
- (void*)&&ZEND_THROW_SPEC_TMP_LABEL,
- (void*)&&ZEND_THROW_SPEC_VAR_LABEL,
+ (void*)&&ZEND_THROW_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_THROW_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_THROW_SPEC_CV_LABEL,
(void*)&&ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_LABEL,
@@ -52297,28 +51033,28 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_CALL_TRAMPOLINE_SPEC_LABEL,
(void*)&&ZEND_DISCARD_EXCEPTION_SPEC_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CONST_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CONST_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CONST_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CONST_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_TMP_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_TMP_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_TMP_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_TMP_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_VAR_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_VAR_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_VAR_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_VAR_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_UNUSED_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_UNUSED_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_UNUSED_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_UNUSED_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CV_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CV_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CV_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CV_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_CV_LABEL,
(void*)&&ZEND_GENERATOR_RETURN_SPEC_CONST_LABEL,
@@ -52331,8 +51067,8 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_RECV_VARIADIC_SPEC_UNUSED_LABEL,
(void*)&&ZEND_SEND_UNPACK_SPEC_LABEL,
(void*)&&ZEND_YIELD_FROM_SPEC_CONST_LABEL,
- (void*)&&ZEND_YIELD_FROM_SPEC_TMP_LABEL,
- (void*)&&ZEND_YIELD_FROM_SPEC_VAR_LABEL,
+ (void*)&&ZEND_YIELD_FROM_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_FROM_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_YIELD_FROM_SPEC_CV_LABEL,
(void*)&&ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_LABEL,
@@ -53744,7 +52480,6 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = RT_CONSTANT(opline, opline->op1);
return_value = EX(return_value);
@@ -53756,9 +52491,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_CONST & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -54272,13 +53007,9 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR)
ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CONST_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_CONST_TMP)
- ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CONST_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_CONST_VAR)
- ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_CASE(ZEND_YIELD_SPEC_CONST_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_CONST_TMPVAR)
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_R_SPEC_CONST_UNUSED):
VM_TRACE(ZEND_FETCH_R_SPEC_CONST_UNUSED)
@@ -54900,6 +53631,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_FE_FREE_SPEC_TMPVAR)
ZEND_FE_FREE_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_THROW_SPEC_TMPVAR):
+ VM_TRACE(ZEND_THROW_SPEC_TMPVAR)
+ ZEND_THROW_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAL_SPEC_TMPVAR):
VM_TRACE(ZEND_SEND_VAL_SPEC_TMPVAR)
ZEND_SEND_VAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -54916,6 +53651,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR)
ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_FROM_SPEC_TMPVAR):
+ VM_TRACE(ZEND_YIELD_FROM_SPEC_TMPVAR)
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_STRLEN_SPEC_TMPVAR):
VM_TRACE(ZEND_STRLEN_SPEC_TMPVAR)
ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55218,9 +53957,8 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -55230,9 +53968,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_TMP_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -55290,10 +54028,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_GENERATOR_RETURN_SPEC_TMP)
ZEND_GENERATOR_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_THROW_SPEC_TMP):
- VM_TRACE(ZEND_THROW_SPEC_TMP)
- ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAL_EX_SPEC_TMP):
VM_TRACE(ZEND_SEND_VAL_EX_SPEC_TMP)
ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55334,10 +54068,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_QM_ASSIGN_SPEC_TMP)
ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_FROM_SPEC_TMP):
- VM_TRACE(ZEND_YIELD_FROM_SPEC_TMP)
- ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_TMP_CONST):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_TMP_CONST)
ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55402,6 +54132,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR)
ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_TMP_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_TMP_TMPVAR)
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_TMP_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_TMP_TMP)
ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55410,14 +54144,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP)
ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_TMP_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_TMP_TMP)
- ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_TMP_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_TMP_VAR)
- ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED):
VM_TRACE(ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED)
ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55504,9 +54230,8 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -55516,9 +54241,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -55576,10 +54301,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_GENERATOR_RETURN_SPEC_VAR)
ZEND_GENERATOR_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_THROW_SPEC_VAR):
- VM_TRACE(ZEND_THROW_SPEC_VAR)
- ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAR_SPEC_VAR):
VM_TRACE(ZEND_SEND_VAR_SPEC_VAR)
ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55648,10 +54369,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_QM_ASSIGN_SPEC_VAR)
ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_FROM_SPEC_VAR):
- VM_TRACE(ZEND_YIELD_FROM_SPEC_VAR)
- ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAR_SIMPLE_SPEC_VAR):
VM_TRACE(ZEND_SEND_VAR_SIMPLE_SPEC_VAR)
ZEND_SEND_VAR_SIMPLE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55920,6 +54637,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR)
ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_VAR_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_VAR_TMPVAR)
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_VAR_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_VAR_TMP)
ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55936,10 +54657,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED)
ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_VAR_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_VAR_TMP)
- ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_VAR_VAR):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_VAR_VAR)
ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55960,10 +54677,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_REF_SPEC_VAR_VAR)
ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_VAR_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_VAR_VAR)
- ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED):
VM_TRACE(ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED)
ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56376,13 +55089,9 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR)
ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_UNUSED_TMP)
- ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_UNUSED_VAR)
- ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_UNUSED_TMPVAR)
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED):
VM_TRACE(ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED)
@@ -56586,7 +55295,6 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = EX_VAR(opline->op1.var);
return_value = EX(return_value);
@@ -56598,9 +55306,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_CV & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -57202,6 +55910,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR)
ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_CV_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_CV_TMPVAR)
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_CV_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_CV_TMP)
ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57218,10 +55930,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED)
ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CV_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_CV_TMP)
- ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_CV_VAR):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_CV_VAR)
ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57246,10 +55954,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INSTANCEOF_SPEC_CV_VAR)
ZEND_INSTANCEOF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CV_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_CV_VAR)
- ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED):
VM_TRACE(ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED)
ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -59518,8 +58222,8 @@ void zend_vm_init(void)
ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER,
ZEND_CATCH_SPEC_CONST_HANDLER,
ZEND_THROW_SPEC_CONST_HANDLER,
- ZEND_THROW_SPEC_TMP_HANDLER,
- ZEND_THROW_SPEC_VAR_HANDLER,
+ ZEND_THROW_SPEC_TMPVAR_HANDLER,
+ ZEND_THROW_SPEC_TMPVAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_THROW_SPEC_CV_HANDLER,
ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_HANDLER,
@@ -59817,28 +58521,28 @@ void zend_vm_init(void)
ZEND_CALL_TRAMPOLINE_SPEC_HANDLER,
ZEND_DISCARD_EXCEPTION_SPEC_HANDLER,
ZEND_YIELD_SPEC_CONST_CONST_HANDLER,
- ZEND_YIELD_SPEC_CONST_TMP_HANDLER,
- ZEND_YIELD_SPEC_CONST_VAR_HANDLER,
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER,
ZEND_YIELD_SPEC_CONST_CV_HANDLER,
ZEND_YIELD_SPEC_TMP_CONST_HANDLER,
- ZEND_YIELD_SPEC_TMP_TMP_HANDLER,
- ZEND_YIELD_SPEC_TMP_VAR_HANDLER,
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER,
ZEND_YIELD_SPEC_TMP_CV_HANDLER,
ZEND_YIELD_SPEC_VAR_CONST_HANDLER,
- ZEND_YIELD_SPEC_VAR_TMP_HANDLER,
- ZEND_YIELD_SPEC_VAR_VAR_HANDLER,
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER,
ZEND_YIELD_SPEC_VAR_CV_HANDLER,
ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER,
- ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER,
- ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER,
ZEND_YIELD_SPEC_UNUSED_CV_HANDLER,
ZEND_YIELD_SPEC_CV_CONST_HANDLER,
- ZEND_YIELD_SPEC_CV_TMP_HANDLER,
- ZEND_YIELD_SPEC_CV_VAR_HANDLER,
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_CV_UNUSED_HANDLER,
ZEND_YIELD_SPEC_CV_CV_HANDLER,
ZEND_GENERATOR_RETURN_SPEC_CONST_HANDLER,
@@ -59851,8 +58555,8 @@ void zend_vm_init(void)
ZEND_RECV_VARIADIC_SPEC_UNUSED_HANDLER,
ZEND_SEND_UNPACK_SPEC_HANDLER,
ZEND_YIELD_FROM_SPEC_CONST_HANDLER,
- ZEND_YIELD_FROM_SPEC_TMP_HANDLER,
- ZEND_YIELD_FROM_SPEC_VAR_HANDLER,
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER,
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_YIELD_FROM_SPEC_CV_HANDLER,
ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HANDLER,
@@ -61142,7 +59846,7 @@ ZEND_API int zend_vm_kind(void)
return ZEND_VM_KIND;
}
-static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)
+static const uint32_t ZEND_FASTCALL zend_vm_get_opcode_handler_idx(uint32_t spec, const zend_op* op)
{
static const int zend_vm_decode[] = {
_UNUSED_CODE, /* 0 = IS_UNUSED */
@@ -61169,20 +59873,20 @@ static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, co
offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);
} else if (spec & SPEC_RULE_SMART_BRANCH) {
offset = offset * 3;
- if ((op+1)->opcode == ZEND_JMPZ) {
+ if (op->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR)) {
offset += 1;
- } else if ((op+1)->opcode == ZEND_JMPNZ) {
+ } else if (op->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR)) {
offset += 2;
}
}
}
- return zend_opcode_handlers[(spec & SPEC_START_MASK) + offset];
+ return (spec & SPEC_START_MASK) + offset;
}
#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC
static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)
{
- return zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);
+ return zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];
}
#endif
@@ -61190,35 +59894,7 @@ static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op*
static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)
{
uint32_t spec = zend_spec_handlers[opcode];
- static const int zend_vm_decode[] = {
- _UNUSED_CODE, /* 0 = IS_UNUSED */
- _CONST_CODE, /* 1 = IS_CONST */
- _TMP_CODE, /* 2 = IS_TMP_VAR */
- _UNUSED_CODE, /* 3 */
- _VAR_CODE, /* 4 = IS_VAR */
- _UNUSED_CODE, /* 5 */
- _UNUSED_CODE, /* 6 */
- _UNUSED_CODE, /* 7 */
- _CV_CODE /* 8 = IS_CV */
- };
- uint32_t offset = 0;
- if (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];
- if (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];
- if (spec & SPEC_EXTRA_MASK) {
- if (spec & SPEC_RULE_OP_DATA) offset = offset * 5 + zend_vm_decode[(op + 1)->op1_type];
- else if (spec & SPEC_RULE_RETVAL) offset = offset * 2 + (op->result_type != IS_UNUSED);
- else if (spec & SPEC_RULE_QUICK_ARG) offset = offset * 2 + (op->op2.num <= MAX_ARG_FLAG_NUM);
- else if (spec & SPEC_RULE_SMART_BRANCH) {
- offset = offset * 3;
- if ((op+1)->opcode == ZEND_JMPZ) {
- offset += 1;
- } else if ((op+1)->opcode == ZEND_JMPNZ) {
- offset += 2;
- }
- }
- else if (spec & SPEC_RULE_ISSET) offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);
- }
- return zend_opcode_handler_funcs[(spec & SPEC_START_MASK) + offset];
+ return zend_opcode_handler_funcs[zend_vm_get_opcode_handler_idx(spec, op)];
}
#endif
@@ -61232,7 +59908,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op)
zend_swap_operands(op);
}
}
- op->handler = zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);
+ op->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];
}
ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)
@@ -61459,7 +60135,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
default:
break;
}
- op->handler = zend_vm_get_opcode_handler_ex(spec, op);
+ op->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(spec, op)];
}
ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 1eabc5687b..d263f542c5 100755
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -77,7 +77,7 @@ $vm_op_flags = array(
"ZEND_VM_EXT_ARRAY_INIT" => 1<<19,
"ZEND_VM_EXT_REF" => 1<<20,
"ZEND_VM_EXT_FETCH_REF" => 1<<21,
- "ZEND_VM_EXT_DIM_OBJ_WRITE" => 1<<22,
+ "ZEND_VM_EXT_DIM_WRITE" => 1<<22,
"ZEND_VM_EXT_MASK" => 0x0f000000,
"ZEND_VM_EXT_NUM" => 0x01000000,
"ZEND_VM_EXT_LAST_CATCH" => 0x02000000,
@@ -134,7 +134,7 @@ $vm_ext_decode = array(
"FETCH_REF" => ZEND_VM_EXT_FETCH_REF,
"SRC" => ZEND_VM_EXT_SRC,
"CACHE_SLOT" => ZEND_VM_EXT_CACHE_SLOT,
- "DIM_OBJ_WRITE" => ZEND_VM_EXT_DIM_OBJ_WRITE,
+ "DIM_WRITE" => ZEND_VM_EXT_DIM_WRITE,
);
$vm_kind_name = array(
@@ -208,54 +208,32 @@ $op2_type = array(
"TMPVARCV" => "(IS_TMP_VAR|IS_VAR|IS_CV)",
);
-$op1_free = array(
- "ANY" => "(free_op1 != NULL)",
- "TMP" => "1",
- "VAR" => "(free_op1 != NULL)",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
- "TMPVAR" => "???",
- "TMPVARCV" => "???",
-);
-
-$op2_free = array(
- "ANY" => "(free_op2 != NULL)",
- "TMP" => "1",
- "VAR" => "(free_op2 != NULL)",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
- "TMPVAR" => "???",
- "TMPVARCV" => "???",
-);
-
$op1_get_zval_ptr = array(
- "ANY" => "get_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op2_get_zval_ptr = array(
- "ANY" => "get_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op1_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -264,9 +242,9 @@ $op1_get_zval_ptr_ptr = array(
);
$op2_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -275,9 +253,9 @@ $op2_get_zval_ptr_ptr = array(
);
$op1_get_zval_ptr_deref = array(
- "ANY" => "get_zval_ptr_deref(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_deref(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -286,9 +264,9 @@ $op1_get_zval_ptr_deref = array(
);
$op2_get_zval_ptr_deref = array(
- "ANY" => "get_zval_ptr_deref(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_deref(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -297,31 +275,31 @@ $op2_get_zval_ptr_deref = array(
);
$op1_get_zval_ptr_undef = array(
- "ANY" => "get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_undef(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op1.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
);
$op2_get_zval_ptr_undef = array(
- "ANY" => "get_zval_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_undef(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op2.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
);
$op1_get_zval_ptr_ptr_undef = array(
- "ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op1.var)",
@@ -330,9 +308,9 @@ $op1_get_zval_ptr_ptr_undef = array(
);
$op2_get_zval_ptr_ptr_undef = array(
- "ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op2.var)",
@@ -341,53 +319,53 @@ $op2_get_zval_ptr_ptr_undef = array(
);
$op1_get_obj_zval_ptr = array(
- "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op2_get_obj_zval_ptr = array(
- "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op1_get_obj_zval_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr_undef(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op1.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
);
$op2_get_obj_zval_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr_undef(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op2.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
);
$op1_get_obj_zval_ptr_deref = array(
- "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -396,9 +374,9 @@ $op1_get_obj_zval_ptr_deref = array(
);
$op2_get_obj_zval_ptr_deref = array(
- "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -407,9 +385,9 @@ $op2_get_obj_zval_ptr_deref = array(
);
$op1_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -418,9 +396,9 @@ $op1_get_obj_zval_ptr_ptr = array(
);
$op2_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -429,9 +407,9 @@ $op2_get_obj_zval_ptr_ptr = array(
);
$op1_get_obj_zval_ptr_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op1.var)",
@@ -440,9 +418,9 @@ $op1_get_obj_zval_ptr_ptr_undef = array(
);
$op2_get_obj_zval_ptr_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op2.var)",
@@ -451,31 +429,31 @@ $op2_get_obj_zval_ptr_ptr_undef = array(
);
$op1_free_op = array(
- "ANY" => "FREE_OP(free_op1)",
- "TMP" => "zval_ptr_dtor_nogc(free_op1)",
- "VAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "ANY" => "FREE_OP(opline->op1_type, opline->op1.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"TMPVARCV" => "???",
);
$op2_free_op = array(
- "ANY" => "FREE_OP(free_op2)",
- "TMP" => "zval_ptr_dtor_nogc(free_op2)",
- "VAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "ANY" => "FREE_OP(opline->op2_type, opline->op2.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"TMPVARCV" => "???",
);
$op1_free_op_if_var = array(
- "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1);}",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));}",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -484,9 +462,9 @@ $op1_free_op_if_var = array(
);
$op2_free_op_if_var = array(
- "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(free_op2);}",
+ "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));}",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -495,9 +473,9 @@ $op2_free_op_if_var = array(
);
$op1_free_op_var_ptr = array(
- "ANY" => "if (free_op1) {zval_ptr_dtor_nogc(free_op1);}",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -506,9 +484,9 @@ $op1_free_op_var_ptr = array(
);
$op2_free_op_var_ptr = array(
- "ANY" => "if (free_op2) {zval_ptr_dtor_nogc(free_op2);}",
+ "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -550,20 +528,20 @@ $op_data_type = array(
);
$op_data_get_zval_ptr = array(
- "ANY" => "get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data)",
- "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "ANY" => "get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1)",
+ "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT((opline+1), (opline+1)->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op_data_get_zval_ptr_deref = array(
- "ANY" => "get_op_data_zval_ptr_deref_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data)",
- "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "ANY" => "get_op_data_zval_ptr_deref_r((opline+1)->op1_type, (opline+1)->op1)",
+ "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT((opline+1), (opline+1)->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
@@ -572,9 +550,9 @@ $op_data_get_zval_ptr_deref = array(
);
$op_data_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, &free_op_data, \\1)",
+ "ANY" => "get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
@@ -583,20 +561,20 @@ $op_data_get_zval_ptr_ptr = array(
);
$op_data_free_op = array(
- "ANY" => "FREE_OP(free_op_data)",
- "TMP" => "zval_ptr_dtor_nogc(free_op_data)",
- "VAR" => "zval_ptr_dtor_nogc(free_op_data)",
+ "ANY" => "FREE_OP((opline+1)->op1_type, (opline+1)->op1.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op_data)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
"TMPVARCV" => "???",
);
$op_data_free_op_var_ptr = array(
- "ANY" => "if (free_op_data) {zval_ptr_dtor_nogc(free_op_data);}",
+ "ANY" => "if ((opline+1)->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -771,7 +749,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
$op1_get_obj_zval_ptr_deref, $op2_get_obj_zval_ptr_deref,
$op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr,
$op1_get_obj_zval_ptr_ptr_undef, $op2_get_obj_zval_ptr_ptr_undef,
- $op1_free, $op2_free, $op1_free_unfetched, $op2_free_unfetched,
+ $op1_free_unfetched, $op2_free_unfetched,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
$op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix,
$op_data_type, $op_data_get_zval_ptr,
@@ -782,8 +760,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
$specialized_replacements = array(
"/OP1_TYPE/" => $op1_type[$op1],
"/OP2_TYPE/" => $op2_type[$op2],
- "/OP1_FREE/" => $op1_free[$op1],
- "/OP2_FREE/" => $op2_free[$op2],
"/GET_OP1_ZVAL_PTR\(([^)]*)\)/" => $op1_get_zval_ptr[$op1],
"/GET_OP2_ZVAL_PTR\(([^)]*)\)/" => $op2_get_zval_ptr[$op2],
"/GET_OP1_ZVAL_PTR_DEREF\(([^)]*)\)/" => $op1_get_zval_ptr_deref[$op1],
@@ -835,19 +811,19 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_JMPZ(\\1, \\2)"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : ""))
+ "ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : "ZEND_VM_SMART_BRANCH_NONE(\\1, \\2)"))
: "ZEND_VM_SMART_BRANCH(\\1, \\2)",
"/ZEND_VM_SMART_BRANCH_TRUE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_TRUE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : ""))
+ "ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : "ZEND_VM_SMART_BRANCH_TRUE_NONE()"))
: "ZEND_VM_SMART_BRANCH_TRUE()",
"/ZEND_VM_SMART_BRANCH_FALSE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_FALSE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : ""))
+ "ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : "ZEND_VM_SMART_BRANCH_FALSE_NONE()"))
: "ZEND_VM_SMART_BRANCH_FALSE()",
"/opline->extended_value\s*&\s*ZEND_ISEMPTY/" => isset($extra_spec['ISSET']) ?
($extra_spec['ISSET'] == 0 ? "0" : "1")
@@ -983,44 +959,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
break;
}
- /* Remove unused free_op1 and free_op2 declarations */
- if ($spec && preg_match_all('/^\s*zend_free_op\s+[^;]+;\s*$/m', $code, $matches, PREG_SET_ORDER)) {
- $n = 0;
- foreach ($matches as $match) {
- $code = preg_replace('/'.preg_quote($match[0],'/').'/', "\$D$n", $code);
- ++$n;
- }
- $del_free_op1 = (strpos($code, "free_op1") === false);
- $del_free_op2 = (strpos($code, "free_op2") === false);
- $del_free_op_data = (strpos($code, "free_op_data") === false);
- $n = 0;
- foreach ($matches as $match) {
- $dcl = $match[0];
- $changed = 0;
- if ($del_free_op1 && strpos($dcl, "free_op1") !== false) {
- $dcl = preg_replace("/free_op1\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op1\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($del_free_op2 && strpos($dcl, "free_op2") !== false) {
- $dcl = preg_replace("/free_op2\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op2\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($del_free_op_data && strpos($dcl, "free_op_data") !== false) {
- $dcl = preg_replace("/free_op_data\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op_data\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($changed) {
- $dcl = preg_replace("/,\s*;/", ";", $dcl);
- $dcl = preg_replace("/zend_free_op\s*;/", "", $dcl);
- }
- $code = preg_replace("/\\\$D$n/", $dcl, $code);
- ++$n;
- }
- }
-
/* Remove unnecessary ';' */
$code = preg_replace('/^\s*;\s*$/m', '', $code);
@@ -2756,10 +2694,10 @@ function gen_vm($def, $skel) {
out($f, "\n");
// Generate zend_vm_get_opcode_handler() function
- out($f, "static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)\n");
+ out($f, "static const uint32_t ZEND_FASTCALL zend_vm_get_opcode_handler_idx(uint32_t spec, const zend_op* op)\n");
out($f, "{\n");
if (!ZEND_VM_SPEC) {
- out($f, "\treturn zend_opcode_handlers[spec];\n");
+ out($f, "\treturn spec;\n");
} else {
out($f, "\tstatic const int zend_vm_decode[] = {\n");
out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
@@ -2808,9 +2746,9 @@ function gen_vm($def, $skel) {
if (isset($used_extra_spec["SMART_BRANCH"])) {
out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
out($f, "\t\t\toffset = offset * 3;\n");
- out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
+ out($f, "\t\t\tif (op->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR)) {\n");
out($f, "\t\t\t\toffset += 1;\n");
- out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
+ out($f, "\t\t\t} else if (op->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR)) {\n");
out($f, "\t\t\t\toffset += 2;\n");
out($f, "\t\t\t}\n");
$else = "} else ";
@@ -2820,16 +2758,16 @@ function gen_vm($def, $skel) {
}
out($f, "\t}\n");
}
- out($f, "\treturn zend_opcode_handlers[(spec & SPEC_START_MASK) + offset];\n");
+ out($f, "\treturn (spec & SPEC_START_MASK) + offset;\n");
}
out($f, "}\n\n");
out($f, "#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n");
out($f, "static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n");
out($f, "{\n");
if (!ZEND_VM_SPEC) {
- out($f, "\treturn zend_vm_get_opcode_handler_ex(opcode, op);\n");
+ out($f, "\treturn zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
- out($f, "\treturn zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
+ out($f, "\treturn zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];\n");
}
out($f, "}\n");
out($f, "#endif\n\n");
@@ -2839,65 +2777,11 @@ function gen_vm($def, $skel) {
out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n");
out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)\n");
out($f, "{\n");
- out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
+ out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
if (!ZEND_VM_SPEC) {
out($f, "\treturn zend_opcode_handler_funcs[spec];\n");
} else {
- out($f, "\tstatic const int zend_vm_decode[] = {\n");
- out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
- out($f, "\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
- out($f, "\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
- out($f, "\t\t_UNUSED_CODE, /* 3 */\n");
- out($f, "\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
- out($f, "\t\t_UNUSED_CODE, /* 5 */\n");
- out($f, "\t\t_UNUSED_CODE, /* 6 */\n");
- out($f, "\t\t_UNUSED_CODE, /* 7 */\n");
- out($f, "\t\t_CV_CODE /* 8 = IS_CV */\n");
- out($f, "\t};\n");
- out($f, "\tuint32_t offset = 0;\n");
- out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");
- out($f, "\tif (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];\n");
-
- if (isset($used_extra_spec["OP_DATA"]) ||
- isset($used_extra_spec["RETVAL"]) ||
- isset($used_extra_spec["QUICK_ARG"]) ||
- isset($used_extra_spec["SMART_BRANCH"]) ||
- isset($used_extra_spec["ISSET"])) {
-
- $else = "";
- out($f, "\tif (spec & SPEC_EXTRA_MASK) {\n");
-
- if (isset($used_extra_spec["OP_DATA"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_OP_DATA) offset = offset * 5 + zend_vm_decode[(op + 1)->op1_type];\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["RETVAL"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_RETVAL) offset = offset * 2 + (op->result_type != IS_UNUSED);\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["QUICK_ARG"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_QUICK_ARG) offset = offset * 2 + (op->op2.num <= MAX_ARG_FLAG_NUM);\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["SMART_BRANCH"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
- out($f, "\t\t\toffset = offset * 3;\n");
- out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
- out($f, "\t\t\t\toffset += 1;\n");
- out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
- out($f, "\t\t\t\toffset += 2;\n");
- out($f, "\t\t\t}\n");
- out($f, "\t\t}\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["ISSET"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_ISSET) offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);\n");
- $else = "else ";
- }
- out($f, "\t}\n");
- }
-
- out($f, "\treturn zend_opcode_handler_funcs[(spec & SPEC_START_MASK) + offset];\n");
+ out($f, "\treturn zend_opcode_handler_funcs[zend_vm_get_opcode_handler_idx(spec, op)];\n");
}
out($f, "}\n\n");
out($f, "#endif\n\n");
@@ -2908,7 +2792,7 @@ function gen_vm($def, $skel) {
out($f, "{\n");
out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
if (!ZEND_VM_SPEC) {
- out($f, "\top->handler = zend_vm_get_opcode_handler(opcode, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
out($f, "\n");
out($f, "\tif (zend_spec_handlers[op->opcode] & SPEC_RULE_COMMUTATIVE) {\n");
@@ -2916,7 +2800,7 @@ function gen_vm($def, $skel) {
out($f, "\t\t\tzend_swap_operands(op);\n");
out($f, "\t\t}\n");
out($f, "\t}\n");
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];\n");
}
out($f, "}\n\n");
@@ -2925,7 +2809,7 @@ function gen_vm($def, $skel) {
out($f, "{\n");
out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
if (!ZEND_VM_SPEC) {
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(opcode, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
if (isset($used_extra_spec["TYPE"])) {
@@ -2994,7 +2878,7 @@ function gen_vm($def, $skel) {
out($f, "\t\t\tbreak;\n");
out($f, "\t}\n");
}
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(spec, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(spec, op)];\n");
}
out($f, "}\n\n");
diff --git a/Zend/zend_vm_handlers.h b/Zend/zend_vm_handlers.h
index 7aa1a93981..306ca3ee45 100644
--- a/Zend/zend_vm_handlers.h
+++ b/Zend/zend_vm_handlers.h
@@ -962,8 +962,8 @@
_(1859, ZEND_SEND_VAR_NO_REF_SPEC_VAR) \
_(1860, ZEND_CATCH_SPEC_CONST) \
_(1861, ZEND_THROW_SPEC_CONST) \
- _(1862, ZEND_THROW_SPEC_TMP) \
- _(1863, ZEND_THROW_SPEC_VAR) \
+ _(1862, ZEND_THROW_SPEC_TMPVAR) \
+ _(1863, ZEND_THROW_SPEC_TMPVAR) \
_(1865, ZEND_THROW_SPEC_CV) \
_(1866, ZEND_FETCH_CLASS_SPEC_UNUSED_CONST) \
_(1867, ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR) \
@@ -1165,28 +1165,28 @@
_(2158, ZEND_CALL_TRAMPOLINE_SPEC) \
_(2159, ZEND_DISCARD_EXCEPTION_SPEC) \
_(2160, ZEND_YIELD_SPEC_CONST_CONST) \
- _(2161, ZEND_YIELD_SPEC_CONST_TMP) \
- _(2162, ZEND_YIELD_SPEC_CONST_VAR) \
+ _(2161, ZEND_YIELD_SPEC_CONST_TMPVAR) \
+ _(2162, ZEND_YIELD_SPEC_CONST_TMPVAR) \
_(2163, ZEND_YIELD_SPEC_CONST_UNUSED) \
_(2164, ZEND_YIELD_SPEC_CONST_CV) \
_(2165, ZEND_YIELD_SPEC_TMP_CONST) \
- _(2166, ZEND_YIELD_SPEC_TMP_TMP) \
- _(2167, ZEND_YIELD_SPEC_TMP_VAR) \
+ _(2166, ZEND_YIELD_SPEC_TMP_TMPVAR) \
+ _(2167, ZEND_YIELD_SPEC_TMP_TMPVAR) \
_(2168, ZEND_YIELD_SPEC_TMP_UNUSED) \
_(2169, ZEND_YIELD_SPEC_TMP_CV) \
_(2170, ZEND_YIELD_SPEC_VAR_CONST) \
- _(2171, ZEND_YIELD_SPEC_VAR_TMP) \
- _(2172, ZEND_YIELD_SPEC_VAR_VAR) \
+ _(2171, ZEND_YIELD_SPEC_VAR_TMPVAR) \
+ _(2172, ZEND_YIELD_SPEC_VAR_TMPVAR) \
_(2173, ZEND_YIELD_SPEC_VAR_UNUSED) \
_(2174, ZEND_YIELD_SPEC_VAR_CV) \
_(2175, ZEND_YIELD_SPEC_UNUSED_CONST) \
- _(2176, ZEND_YIELD_SPEC_UNUSED_TMP) \
- _(2177, ZEND_YIELD_SPEC_UNUSED_VAR) \
+ _(2176, ZEND_YIELD_SPEC_UNUSED_TMPVAR) \
+ _(2177, ZEND_YIELD_SPEC_UNUSED_TMPVAR) \
_(2178, ZEND_YIELD_SPEC_UNUSED_UNUSED) \
_(2179, ZEND_YIELD_SPEC_UNUSED_CV) \
_(2180, ZEND_YIELD_SPEC_CV_CONST) \
- _(2181, ZEND_YIELD_SPEC_CV_TMP) \
- _(2182, ZEND_YIELD_SPEC_CV_VAR) \
+ _(2181, ZEND_YIELD_SPEC_CV_TMPVAR) \
+ _(2182, ZEND_YIELD_SPEC_CV_TMPVAR) \
_(2183, ZEND_YIELD_SPEC_CV_UNUSED) \
_(2184, ZEND_YIELD_SPEC_CV_CV) \
_(2185, ZEND_GENERATOR_RETURN_SPEC_CONST) \
@@ -1198,8 +1198,8 @@
_(2192, ZEND_RECV_VARIADIC_SPEC_UNUSED) \
_(2193, ZEND_SEND_UNPACK_SPEC) \
_(2194, ZEND_YIELD_FROM_SPEC_CONST) \
- _(2195, ZEND_YIELD_FROM_SPEC_TMP) \
- _(2196, ZEND_YIELD_FROM_SPEC_VAR) \
+ _(2195, ZEND_YIELD_FROM_SPEC_TMPVAR) \
+ _(2196, ZEND_YIELD_FROM_SPEC_TMPVAR) \
_(2198, ZEND_YIELD_FROM_SPEC_CV) \
_(2199, ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED) \
_(2200, ZEND_BIND_GLOBAL_SPEC_CV_CONST) \
diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c
index 3290d760be..6f7252c8f5 100644
--- a/Zend/zend_vm_opcodes.c
+++ b/Zend/zend_vm_opcodes.c
@@ -284,7 +284,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000000,
0x01040310,
0x00000003,
- 0x0000a110,
+ 0x00040110,
0x00040310,
0x00001007,
0x00001001,
@@ -329,7 +329,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x01000000,
0x00001001,
0x02042003,
- 0x00000003,
+ 0x00000007,
0x00040771,
0x00000057,
0x0b000003,
@@ -381,13 +381,13 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000071,
0x00000000,
0x00000000,
- 0x0b000303,
+ 0x0b000703,
0x00000003,
0x00000020,
0x00003000,
- 0x0000a110,
+ 0x00040110,
0x00000000,
- 0x00000003,
+ 0x00000007,
0x00000105,
0x00040301,
0x00002003,
diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h
index d06f44e889..60bcb66643 100644
--- a/Zend/zend_vm_opcodes.h
+++ b/Zend/zend_vm_opcodes.h
@@ -54,7 +54,7 @@
#define ZEND_VM_EXT_ARRAY_INIT 0x00080000
#define ZEND_VM_EXT_REF 0x00100000
#define ZEND_VM_EXT_FETCH_REF 0x00200000
-#define ZEND_VM_EXT_DIM_OBJ_WRITE 0x00400000
+#define ZEND_VM_EXT_DIM_WRITE 0x00400000
#define ZEND_VM_EXT_MASK 0x0f000000
#define ZEND_VM_EXT_NUM 0x01000000
#define ZEND_VM_EXT_LAST_CATCH 0x02000000
diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c
index b73a5963aa..aae1998d6c 100644
--- a/Zend/zend_weakrefs.c
+++ b/Zend/zend_weakrefs.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
@@ -112,13 +110,13 @@ static void zend_weakref_free(zend_object *zo) {
#define zend_weakref_unsupported(thing) \
zend_throw_error(NULL, "WeakReference objects do not support " thing);
-static ZEND_COLD zval* zend_weakref_no_write(zval *object, zval *member, zval *value, void **rtc) {
+static ZEND_COLD zval* zend_weakref_no_write(zend_object *object, zend_string *member, zval *value, void **rtc) {
zend_weakref_unsupported("properties");
return &EG(uninitialized_zval);
}
-static ZEND_COLD zval* zend_weakref_no_read(zval *object, zval *member, int type, void **rtc, zval *rv) {
+static ZEND_COLD zval* zend_weakref_no_read(zend_object *object, zend_string *member, int type, void **rtc, zval *rv) {
if (!EG(exception)) {
zend_weakref_unsupported("properties");
}
@@ -126,19 +124,19 @@ static ZEND_COLD zval* zend_weakref_no_read(zval *object, zval *member, int type
return &EG(uninitialized_zval);
}
-static ZEND_COLD zval *zend_weakref_no_read_ptr(zval *object, zval *member, int type, void **rtc) {
+static ZEND_COLD zval *zend_weakref_no_read_ptr(zend_object *object, zend_string *member, int type, void **rtc) {
zend_weakref_unsupported("property references");
return NULL;
}
-static ZEND_COLD int zend_weakref_no_isset(zval *object, zval *member, int hse, void **rtc) {
+static ZEND_COLD int zend_weakref_no_isset(zend_object *object, zend_string *member, int hse, void **rtc) {
if (hse != 2) {
zend_weakref_unsupported("properties");
}
return 0;
}
-static ZEND_COLD void zend_weakref_no_unset(zval *object, zval *member, void **rtc) {
+static ZEND_COLD void zend_weakref_no_unset(zend_object *object, zend_string *member, void **rtc) {
zend_weakref_unsupported("properties");
}
diff --git a/Zend/zend_weakrefs.h b/Zend/zend_weakrefs.h
index c8a65e2563..cf902f3dd4 100644
--- a/Zend/zend_weakrefs.h
+++ b/Zend/zend_weakrefs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |